tdoc-0.4.7: TDoc is a typed document builder with support for (X)HTML

Safe HaskellSafe
LanguageHaskell98

Text.TDoc.Core

Synopsis

Documentation

class (IsNode father, IsNode child) => IsChildOf child father Source #

Instances

IsInline a => IsChildOf a Paragraph Source # 
IsBlockOrInline a => IsChildOf a Col Source # 
IsBlockOrInline a => IsChildOf a HCol Source # 
IsBlockOrInline a => IsChildOf a Item Source # 
IsInline a => IsChildOf a Span Source # 
IsBlock a => IsChildOf a Subsection Source # 
IsInline a => IsChildOf a HLink Source # 
IsInline a => IsChildOf a Label Source # 
IsChildOf Leaf Title Source # 
IsChildOf Leaf Option Source # 
IsChildOf Leaf Textarea Source # 
IsChildOf Paragraph Section Source # 
IsChildOf Paragraph Document Source # 
IsChildOf Title Preambule Source # 
IsChildOf Hr Section Source # 
IsChildOf Hr Document Source # 
IsChildOf Col Row Source # 
IsChildOf HCol Row Source # 
IsChildOf Row Table Source # 
IsChildOf Table Section Source # 
IsChildOf Table Document Source # 
IsChildOf Item UList Source # 
IsChildOf UList Section Source # 
IsChildOf UList Document Source # 
IsChildOf Span Anchor Source # 
IsChildOf Subsection Section Source # 
IsChildOf Section Document Source # 
IsChildOf Preambule Root Source # 
IsChildOf Document Root Source # 
IsChildOf Label Form Source # 
IsChildOf Input Form Source # 
IsChildOf Option Select Source # 
IsChildOf Select Form Source # 
IsChildOf Textarea Form Source # 
IsChildOf Form Document Source # 
IsChildOf b a => IsChildOf b (Div a) Source # 
(~) * a Section => IsChildOf (Div a) Section Source # 
(~) * a Document => IsChildOf (Div a) Document Source # 
(~) * Form a => IsChildOf (Div a) Form Source # 

data AttributeOf t node Source #

Constructors

attr `IsAttributeOf` node => TAttr (t attr) attr 

type AttributesOf t node = [AttributeOf t node] Source #

data TDoc t tag Source #

Constructors

TNode 

Fields

Instances

((~) (* -> *) t1 t2, (~) * a b) => FromTDoc (TDoc t1 a) t2 b Source # 

Methods

fromTDoc :: TDoc t2 b -> TDoc t1 a Source #

((~) (* -> *) t1 t2, (~) * a b) => AddAttrs (TDoc t1 a) t2 b Source # 

Methods

(!) :: TDoc t1 a -> AttributesOf t2 b -> TDoc t1 a Source #

((~) (* -> *) t1 t2, (~) * a b) => ToTDoc (TDoc t1 a) t2 b Source # 

Methods

toTDoc :: TDoc t1 a -> TDoc t2 b Source #

((~) (* -> *) t1 t2, IsChildOf a b) => ToChildren (TDoc t1 a) t2 b Source # 

Methods

toChildren :: TDoc t1 a -> [ChildOf t2 b] Source #

data ChildOf t father Source #

Constructors

child `IsChildOf` father => Child (TDoc t child) 

Instances

((~) (* -> *) t1 t2, IsChildOf b a) => FromTDoc (ChildOf t1 a) t2 b Source # 

Methods

fromTDoc :: TDoc t2 b -> ChildOf t1 a Source #

((~) (* -> *) t1 t2, (~) * a b) => ToChildren (ChildOf t1 a) t2 b Source # 

Methods

toChildren :: ChildOf t1 a -> [ChildOf t2 b] Source #

class ToChildren a t father where Source #

Minimal complete definition

toChildren

Methods

toChildren :: a -> [ChildOf t father] Source #

Instances

ToChildren () t b Source # 

Methods

toChildren :: () -> [ChildOf t b] Source #

ToChildren a t b => ToChildren [a] t b Source # 

Methods

toChildren :: [a] -> [ChildOf t b] Source #

ToChildren a t b => ToChildren (Identity a) t b Source # 

Methods

toChildren :: Identity a -> [ChildOf t b] Source #

(ToChildren a t n, ToChildren b t n) => ToChildren (a, b) t n Source # 

Methods

toChildren :: (a, b) -> [ChildOf t n] Source #

((~) (* -> *) t1 t2, (~) * a b) => ToChildren (ChildOf t1 a) t2 b Source # 

Methods

toChildren :: ChildOf t1 a -> [ChildOf t2 b] Source #

((~) (* -> *) t1 t2, IsChildOf a b) => ToChildren (TDoc t1 a) t2 b Source # 

Methods

toChildren :: TDoc t1 a -> [ChildOf t2 b] Source #

(ToChildren a t n, ToChildren b t n, ToChildren c t n) => ToChildren (a, b, c) t n Source # 

Methods

toChildren :: (a, b, c) -> [ChildOf t n] Source #

(Monad m, ToChildren (m w) t b, (~) * a ()) => ToChildren (WriterT w m a) t b Source # 

Methods

toChildren :: WriterT w m a -> [ChildOf t b] Source #

class ToTDoc a t b where Source #

Minimal complete definition

toTDoc

Methods

toTDoc :: a -> TDoc t b Source #

Instances

ToTDoc a t b => ToTDoc (Identity a) t b Source # 

Methods

toTDoc :: Identity a -> TDoc t b Source #

((~) (* -> *) t1 t2, (~) * a b) => ToTDoc (TDoc t1 a) t2 b Source # 

Methods

toTDoc :: TDoc t1 a -> TDoc t2 b Source #

(Monad m, ToTDoc (m w) t b, (~) * a ()) => ToTDoc (WriterT w m a) t b Source # 

Methods

toTDoc :: WriterT w m a -> TDoc t b Source #

class AddAttrs a t b where Source #

Minimal complete definition

(!)

Methods

(!) :: a -> AttributesOf t b -> a infixl 8 Source #

Instances

AddAttrs b t c => AddAttrs (a -> b) t c Source # 

Methods

(!) :: (a -> b) -> AttributesOf t c -> a -> b Source #

((~) (* -> *) t1 t2, (~) * a b) => AddAttrs (TDoc t1 a) t2 b Source # 

Methods

(!) :: TDoc t1 a -> AttributesOf t2 b -> TDoc t1 a Source #

class FromTDoc a t tag where Source #

Minimal complete definition

fromTDoc

Methods

fromTDoc :: TDoc t tag -> a Source #

Instances

FromTDoc a t tag => FromTDoc [a] t tag Source # 

Methods

fromTDoc :: TDoc t tag -> [a] Source #

FromTDoc a t tag => FromTDoc (Identity a) t tag Source # 

Methods

fromTDoc :: TDoc t tag -> Identity a Source #

((~) (* -> *) t1 t2, IsChildOf b a) => FromTDoc (ChildOf t1 a) t2 b Source # 

Methods

fromTDoc :: TDoc t2 b -> ChildOf t1 a Source #

((~) (* -> *) t1 t2, (~) * a b) => FromTDoc (TDoc t1 a) t2 b Source # 

Methods

fromTDoc :: TDoc t2 b -> TDoc t1 a Source #

(Monad m, FromTDoc w t tag, Monoid w, (~) * a ()) => FromTDoc (WriterT w m a) t tag Source # 

Methods

fromTDoc :: TDoc t tag -> WriterT w m a Source #

type PutM a = Writer [a] () Source #

type Star t node = forall children. ToChildren children t node => children -> TDoc t node Source #

type Nullary t node = TDoc t node Source #

type Unary t node = forall child. child `IsChildOf` node => TDoc t child -> TDoc t node Source #

type Plus t node = forall children child. (child `IsChildOf` node, ToChildren children t node) => TDoc t child -> children -> TDoc t node Source #

(+++) :: (ToChildren a t tag, ToChildren b t tag) => a -> b -> [ChildOf t tag] infixr 2 Source #

(<<) :: a `IsChildOf` b => (c -> TDoc t a) -> c -> PutM (ChildOf t b) infixr 7 Source #

This operator is an infix sugar for put paragraph << do ... is equal to put $ paragraph $ do ....

put :: ToChildren children t father => children -> PutM (ChildOf t father) Source #

tStar :: t a -> Star t a Source #

tNullary :: t a -> Nullary t a Source #

tUnary :: t a -> Unary t a Source #

tPlus :: t a -> Plus t a Source #