backend-0.1.0.0
LicenseAGPL-3
Maintainerstu235271@mail.uni-kiel.de stu236925@mail.uni-kiel.de
Safe HaskellNone
LanguageHaskell2010

Docs.Tree

Description

This module contains the definition of the tree structure of a Document.

Synopsis

Documentation

data Tree a Source #

A tree. Either a tree or a leaf.

Constructors

Tree (Node a) 
Leaf a 

Instances

Instances details
Foldable Tree Source # 
Instance details

Defined in Docs.Tree

Methods

fold :: Monoid m => Tree m -> m #

foldMap :: Monoid m => (a -> m) -> Tree a -> m #

foldMap' :: Monoid m => (a -> m) -> Tree a -> m #

foldr :: (a -> b -> b) -> b -> Tree a -> b #

foldr' :: (a -> b -> b) -> b -> Tree a -> b #

foldl :: (b -> a -> b) -> b -> Tree a -> b #

foldl' :: (b -> a -> b) -> b -> Tree a -> b #

foldr1 :: (a -> a -> a) -> Tree a -> a #

foldl1 :: (a -> a -> a) -> Tree a -> a #

toList :: Tree a -> [a] #

null :: Tree a -> Bool #

length :: Tree a -> Int #

elem :: Eq a => a -> Tree a -> Bool #

maximum :: Ord a => Tree a -> a #

minimum :: Ord a => Tree a -> a #

sum :: Num a => Tree a -> a #

product :: Num a => Tree a -> a #

Traversable Tree Source # 
Instance details

Defined in Docs.Tree

Methods

traverse :: Applicative f => (a -> f b) -> Tree a -> f (Tree b) #

sequenceA :: Applicative f => Tree (f a) -> f (Tree a) #

mapM :: Monad m => (a -> m b) -> Tree a -> m (Tree b) #

sequence :: Monad m => Tree (m a) -> m (Tree a) #

Functor Tree Source # 
Instance details

Defined in Docs.Tree

Methods

fmap :: (a -> b) -> Tree a -> Tree b #

(<$) :: a -> Tree b -> Tree a #

FromJSON a => FromJSON (Tree a) Source # 
Instance details

Defined in Docs.Tree

Methods

parseJSON :: Value -> Parser (Tree a)

parseJSONList :: Value -> Parser [Tree a]

omittedField :: Maybe (Tree a)

ToJSON a => ToJSON (Tree a) Source # 
Instance details

Defined in Docs.Tree

Methods

toJSON :: Tree a -> Value

toEncoding :: Tree a -> Encoding

toJSONList :: [Tree a] -> Value

toEncodingList :: [Tree a] -> Encoding

omitField :: Tree a -> Bool

ToSchema a => ToSchema (Tree a) Source # 
Instance details

Defined in Docs.Tree

Methods

declareNamedSchema :: Proxy (Tree a) -> Declare (Definitions Schema) NamedSchema

data Node a Source #

A node of a tree.

Constructors

Node 

Fields

Instances

Instances details
Foldable Node Source # 
Instance details

Defined in Docs.Tree

Methods

fold :: Monoid m => Node m -> m #

foldMap :: Monoid m => (a -> m) -> Node a -> m #

foldMap' :: Monoid m => (a -> m) -> Node a -> m #

foldr :: (a -> b -> b) -> b -> Node a -> b #

foldr' :: (a -> b -> b) -> b -> Node a -> b #

foldl :: (b -> a -> b) -> b -> Node a -> b #

foldl' :: (b -> a -> b) -> b -> Node a -> b #

foldr1 :: (a -> a -> a) -> Node a -> a #

foldl1 :: (a -> a -> a) -> Node a -> a #

toList :: Node a -> [a] #

null :: Node a -> Bool #

length :: Node a -> Int #

elem :: Eq a => a -> Node a -> Bool #

maximum :: Ord a => Node a -> a #

minimum :: Ord a => Node a -> a #

sum :: Num a => Node a -> a #

product :: Num a => Node a -> a #

Traversable Node Source # 
Instance details

Defined in Docs.Tree

Methods

traverse :: Applicative f => (a -> f b) -> Node a -> f (Node b) #

sequenceA :: Applicative f => Node (f a) -> f (Node a) #

mapM :: Monad m => (a -> m b) -> Node a -> m (Node b) #

sequence :: Monad m => Node (m a) -> m (Node a) #

Functor Node Source # 
Instance details

Defined in Docs.Tree

Methods

fmap :: (a -> b) -> Node a -> Node b #

(<$) :: a -> Node b -> Node a #

FromJSON a => FromJSON (Node a) Source # 
Instance details

Defined in Docs.Tree

Methods

parseJSON :: Value -> Parser (Node a)

parseJSONList :: Value -> Parser [Node a]

omittedField :: Maybe (Node a)

ToJSON a => ToJSON (Node a) Source # 
Instance details

Defined in Docs.Tree

Methods

toJSON :: Node a -> Value

toEncoding :: Node a -> Encoding

toJSONList :: [Node a] -> Value

toEncodingList :: [Node a] -> Encoding

omitField :: Node a -> Bool

Generic (Node a) Source # 
Instance details

Defined in Docs.Tree

Associated Types

type Rep (Node a) 
Instance details

Defined in Docs.Tree

type Rep (Node a) = D1 ('MetaData "Node" "Docs.Tree" "backend-0.1.0.0-2H73EnUlGVcEtlIi2XNQz3" 'False) (C1 ('MetaCons "Node" 'PrefixI 'True) (S1 ('MetaSel ('Just "header") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NodeHeader) :*: S1 ('MetaSel ('Just "children") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Tree a])))

Methods

from :: Node a -> Rep (Node a) x #

to :: Rep (Node a) x -> Node a #

ToSchema a => ToSchema (Node a) Source # 
Instance details

Defined in Docs.Tree

Methods

declareNamedSchema :: Proxy (Node a) -> Declare (Definitions Schema) NamedSchema

type Rep (Node a) Source # 
Instance details

Defined in Docs.Tree

type Rep (Node a) = D1 ('MetaData "Node" "Docs.Tree" "backend-0.1.0.0-2H73EnUlGVcEtlIi2XNQz3" 'False) (C1 ('MetaCons "Node" 'PrefixI 'True) (S1 ('MetaSel ('Just "header") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NodeHeader) :*: S1 ('MetaSel ('Just "children") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Tree a])))

data NodeHeader Source #

Contains metdata for a tree node.

Constructors

NodeHeader 

Instances

Instances details
FromJSON NodeHeader Source # 
Instance details

Defined in Docs.Tree

Methods

parseJSON :: Value -> Parser NodeHeader

parseJSONList :: Value -> Parser [NodeHeader]

omittedField :: Maybe NodeHeader

ToJSON NodeHeader Source # 
Instance details

Defined in Docs.Tree

Methods

toJSON :: NodeHeader -> Value

toEncoding :: NodeHeader -> Encoding

toJSONList :: [NodeHeader] -> Value

toEncodingList :: [NodeHeader] -> Encoding

omitField :: NodeHeader -> Bool

Hashable NodeHeader Source # 
Instance details

Defined in Docs.Tree

Methods

updateHash :: Ctx -> NodeHeader -> Ctx Source #

hash :: NodeHeader -> Hash Source #

Generic NodeHeader Source # 
Instance details

Defined in Docs.Tree

Associated Types

type Rep NodeHeader 
Instance details

Defined in Docs.Tree

type Rep NodeHeader = D1 ('MetaData "NodeHeader" "Docs.Tree" "backend-0.1.0.0-2H73EnUlGVcEtlIi2XNQz3" 'False) (C1 ('MetaCons "NodeHeader" 'PrefixI 'True) (S1 ('MetaSel ('Just "headerKind") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "headerType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "heading") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)))))
Show NodeHeader Source # 
Instance details

Defined in Docs.Tree

ToSchema NodeHeader Source # 
Instance details

Defined in Docs.Tree

Methods

declareNamedSchema :: Proxy NodeHeader -> Declare (Definitions Schema) NamedSchema

type Rep NodeHeader Source # 
Instance details

Defined in Docs.Tree

type Rep NodeHeader = D1 ('MetaData "NodeHeader" "Docs.Tree" "backend-0.1.0.0-2H73EnUlGVcEtlIi2XNQz3" 'False) (C1 ('MetaCons "NodeHeader" 'PrefixI 'True) (S1 ('MetaSel ('Just "headerKind") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "headerType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "heading") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)))))

data WithTitle a Source #

Wrapper type to add a title to an element.

Constructors

WithTitle 

Fields

Instances

Instances details
FromJSON a => FromJSON (WithTitle a) Source # 
Instance details

Defined in Docs.Tree

Methods

parseJSON :: Value -> Parser (WithTitle a)

parseJSONList :: Value -> Parser [WithTitle a]

omittedField :: Maybe (WithTitle a)

ToJSON a => ToJSON (WithTitle a) Source # 
Instance details

Defined in Docs.Tree

Methods

toJSON :: WithTitle a -> Value

toEncoding :: WithTitle a -> Encoding

toJSONList :: [WithTitle a] -> Value

toEncodingList :: [WithTitle a] -> Encoding

omitField :: WithTitle a -> Bool

Generic (WithTitle a) Source # 
Instance details

Defined in Docs.Tree

Associated Types

type Rep (WithTitle a) 
Instance details

Defined in Docs.Tree

type Rep (WithTitle a) = D1 ('MetaData "WithTitle" "Docs.Tree" "backend-0.1.0.0-2H73EnUlGVcEtlIi2XNQz3" 'False) (C1 ('MetaCons "WithTitle" 'PrefixI 'True) (S1 ('MetaSel ('Just "title") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "content") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

Methods

from :: WithTitle a -> Rep (WithTitle a) x #

to :: Rep (WithTitle a) x -> WithTitle a #

ToSchema a => ToSchema (WithTitle a) Source # 
Instance details

Defined in Docs.Tree

Methods

declareNamedSchema :: Proxy (WithTitle a) -> Declare (Definitions Schema) NamedSchema

type Rep (WithTitle a) Source # 
Instance details

Defined in Docs.Tree

type Rep (WithTitle a) = D1 ('MetaData "WithTitle" "Docs.Tree" "backend-0.1.0.0-2H73EnUlGVcEtlIi2XNQz3" 'False) (C1 ('MetaCons "WithTitle" 'PrefixI 'True) (S1 ('MetaSel ('Just "title") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "content") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

treeMapM :: Monad m => (a -> m b) -> Node a -> m (Node b) Source #

Basically mapM for a tree

withTextRevisions Source #

Arguments

:: Monad m 
=> (TextElementID -> m (Maybe TextRevision))

(potentially effectful) function for obtaining a text revision

-> Node TextElement

document structure tree

-> m (Node TextElementRevision)

document structure tree with concrete text revisions

Takes a tree and emplaces concrete text revision. | The text revions are obtained via the specified getter function.

filterMapNode :: (a -> Maybe b) -> Node a -> Node b Source #

Basically fmap for the root node of a tree.