doctemplates-0.11.0.1: Pandoc-style document templates

Copyright | Copyright (C) 2009-2019 John MacFarlane
License | BSD3
Maintainer | John MacFarlane <jgm@berkeley.edu>
Stability | alpha
Portability | portable
Safe Haskell | None
Language | Haskell2010

Text.DocTemplates.Internal

Description

Synopsis

- renderTemplate :: (TemplateTarget a, ToContext a b) => Template a -> b -> Doc a
- class Monad m => TemplateMonad (m :: Type -> Type) where
  - getPartial :: FilePath -> m Text
- newtype Context a = Context {
  - unContext :: Map Text (Val a)
  }
- data Val a
  - = SimpleVal (Doc a)
  - | ListVal [Val a]
  - | MapVal (Context a)
  - | BoolVal Bool
  - | NullVal
- class ToContext a b where
  - toContext :: b -> Context a
  - toVal :: b -> Val a
- class FromContext a b where
  - fromVal :: Val a -> Maybe b
  - lookupContext :: Text -> Context a -> Maybe b
- type TemplateTarget a = (HasChars a, ToText a, FromText a)
- data Template a
  - = Interpolate Variable
  - | Conditional Variable (Template a) (Template a)
  - | Iterate Variable (Template a) (Template a)
  - | Nested (Template a)
  - | Partial [Pipe] (Template a)
  - | Literal (Doc a)
  - | Concat (Template a) (Template a)
  - | Empty
- data Variable = Variable {
  - varParts :: [Text]
  - varPipes :: [Pipe]
  }
- data Pipe
  - = ToPairs
  - | ToUppercase
  - | ToLowercase
  - | ToLength
  - | Reverse
  - | FirstItem
  - | LastItem
  - | Rest
  - | AllButLast
  - | Chomp
  - | ToAlpha
  - | ToRoman
  - | NoWrap
  - | Block Alignment Int Border
- data Alignment
  - = LeftAligned
  - | Centered
  - | RightAligned
- data Border = Border {
  - borderLeft :: Text
  - borderRight :: Text
  }

# Documentation

renderTemplate :: (TemplateTarget a, ToContext a b) => Template a -> b -> Doc a Source #

Render a compiled template in a "context" which provides values for the template's variables.

class Monad m => TemplateMonad (m :: Type -> Type) where Source #

A `TemplateMonad` defines a function to retrieve a partial (from the file system, from a database, or using a default value).

Methods

getPartial :: FilePath -> m Text Source #

#### Instances

Instances details

TemplateMonad Identity Source # |
Instance details Defined in Text.DocTemplates.Internal Methods getPartial :: FilePath -> Identity Text Source #
TemplateMonad IO Source # |
Instance details Defined in Text.DocTemplates.Internal Methods getPartial :: FilePath -> IO Text Source #

newtype Context a Source #

A `Context` defines values for template's variables.

Constructors

Context |

Fields

- unContext :: Map Text (Val a)

#### Instances

Instances details

Functor Context Source # |
Instance details Defined in Text.DocTemplates.Internal Methods fmap :: (a -> b) -> Context a -> Context b Source # (<$) :: a -> Context b -> Context a Source #
Foldable Context Source # |

Instance details

Defined in Text.DocTemplates.Internal

Methods

fold :: Monoid m => Context m -> m Source #

foldMap :: Monoid m => (a -> m) -> Context a -> m Source #

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

foldr :: (a -> b -> b) -> b -> Context a -> b Source #

foldr' :: (a -> b -> b) -> b -> Context a -> b Source #

foldl :: (b -> a -> b) -> b -> Context a -> b Source #

foldl' :: (b -> a -> b) -> b -> Context a -> b Source #

foldr1 :: (a -> a -> a) -> Context a -> a Source #

foldl1 :: (a -> a -> a) -> Context a -> a Source #

toList :: Context a -> [a] Source #

null :: Context a -> Bool Source #

length :: Context a -> Int Source #

elem :: Eq a => a -> Context a -> Bool Source #

maximum :: Ord a => Context a -> a Source #

minimum :: Ord a => Context a -> a Source #

sum :: Num a => Context a -> a Source #

product :: Num a => Context a -> a Source #

Traversable Context Source # |
Instance details Defined in Text.DocTemplates.Internal Methods traverse :: Applicative f => (a -> f b) -> Context a -> f (Context b) Source # sequenceA :: Applicative f => Context (f a) -> f (Context a) Source # mapM :: Monad m => (a -> m b) -> Context a -> m (Context b) Source # sequence :: Monad m => Context (m a) -> m (Context a) Source #
ToContext a (Context a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods toContext :: Context a -> Context a Source # toVal :: Context a -> Val a Source #
TemplateTarget a => FromJSON (Context a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods parseJSON :: Value -> Parser (Context a) Source # parseJSONList :: Value -> Parser [Context a] Source # omittedField :: Maybe (Context a) Source #
TemplateTarget a => ToJSON (Context a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods toJSON :: Context a -> Value Source # toEncoding :: Context a -> Encoding Source # toJSONList :: [Context a] -> Value Source # toEncodingList :: [Context a] -> Encoding Source # omitField :: Context a -> Bool Source #
Monoid (Context a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods mempty :: Context a Source # mappend :: Context a -> Context a -> Context a Source # mconcat :: [Context a] -> Context a Source #
Semigroup (Context a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods (<>) :: Context a -> Context a -> Context a Source # sconcat :: NonEmpty (Context a) -> Context a Source # stimes :: Integral b => b -> Context a -> Context a Source #
Data a => Data (Context a) Source # |

Instance details

Defined in Text.DocTemplates.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Context a -> c (Context a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Context a) Source #

toConstr :: Context a -> Constr Source #

dataTypeOf :: Context a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Context a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Context a)) Source #

gmapT :: (forall b. Data b => b -> b) -> Context a -> Context a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Context a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Context a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Context a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Context a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Context a -> m (Context a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Context a -> m (Context a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Context a -> m (Context a) Source #

Show a => Show (Context a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods showsPrec :: Int -> Context a -> ShowS Source # show :: Context a -> String Source # showList :: [Context a] -> ShowS Source #

data Val a Source #

A variable value.

Constructors

SimpleVal (Doc a) |
ListVal [Val a] |
MapVal (Context a) |
BoolVal Bool |
NullVal |

#### Instances

Instances details

Functor Val Source # |
Instance details Defined in Text.DocTemplates.Internal Methods fmap :: (a -> b) -> Val a -> Val b Source # (<$) :: a -> Val b -> Val a Source #
Foldable Val Source # |

Instance details

Defined in Text.DocTemplates.Internal

Methods

fold :: Monoid m => Val m -> m Source #

foldMap :: Monoid m => (a -> m) -> Val a -> m Source #

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

foldr :: (a -> b -> b) -> b -> Val a -> b Source #

foldr' :: (a -> b -> b) -> b -> Val a -> b Source #

foldl :: (b -> a -> b) -> b -> Val a -> b Source #

foldl' :: (b -> a -> b) -> b -> Val a -> b Source #

foldr1 :: (a -> a -> a) -> Val a -> a Source #

foldl1 :: (a -> a -> a) -> Val a -> a Source #

toList :: Val a -> [a] Source #

null :: Val a -> Bool Source #

length :: Val a -> Int Source #

elem :: Eq a => a -> Val a -> Bool Source #

maximum :: Ord a => Val a -> a Source #

minimum :: Ord a => Val a -> a Source #

sum :: Num a => Val a -> a Source #

product :: Num a => Val a -> a Source #

Traversable Val Source # |
Instance details Defined in Text.DocTemplates.Internal Methods traverse :: Applicative f => (a -> f b) -> Val a -> f (Val b) Source # sequenceA :: Applicative f => Val (f a) -> f (Val a) Source # mapM :: Monad m => (a -> m b) -> Val a -> m (Val b) Source # sequence :: Monad m => Val (m a) -> m (Val a) Source #
TemplateTarget a => FromContext a (Val a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods fromVal :: Val a -> Maybe (Val a) Source # lookupContext :: Text -> Context a -> Maybe (Val a) Source #
ToContext a (Val a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods toContext :: Val a -> Context a Source # toVal :: Val a -> Val a Source #
TemplateTarget a => FromJSON (Val a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods parseJSON :: Value -> Parser (Val a) Source # parseJSONList :: Value -> Parser [Val a] Source # omittedField :: Maybe (Val a) Source #
TemplateTarget a => ToJSON (Val a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods toJSON :: Val a -> Value Source # toEncoding :: Val a -> Encoding Source # toJSONList :: [Val a] -> Value Source # toEncodingList :: [Val a] -> Encoding Source # omitField :: Val a -> Bool Source #
Data a => Data (Val a) Source # |

Instance details

Defined in Text.DocTemplates.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Val a -> c (Val a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Val a) Source #

toConstr :: Val a -> Constr Source #

dataTypeOf :: Val a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Val a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Val a)) Source #

gmapT :: (forall b. Data b => b -> b) -> Val a -> Val a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Val a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Val a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Val a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Val a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Val a -> m (Val a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Val a -> m (Val a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Val a -> m (Val a) Source #

Show a => Show (Val a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods showsPrec :: Int -> Val a -> ShowS Source # show :: Val a -> String Source # showList :: [Val a] -> ShowS Source #

class ToContext a b where Source #

The `ToContext` class provides automatic conversion to a `Context` or `Val`.

Minimal complete definition

toVal

Methods

toContext :: b -> Context a Source #

toVal :: b -> Val a Source #

#### Instances

Instances details

TemplateTarget a => ToContext a Value Source # |
Instance details Defined in Text.DocTemplates.Internal Methods toContext :: Value -> Context a Source # toVal :: Value -> Val a Source #
TemplateTarget a => ToContext a Bool Source # |
Instance details Defined in Text.DocTemplates.Internal Methods toContext :: Bool -> Context a Source # toVal :: Bool -> Val a Source #
TemplateTarget a => ToContext a a Source # |
Instance details Defined in Text.DocTemplates.Internal Methods toContext :: a -> Context a Source # toVal :: a -> Val a Source #
ToContext a a => ToContext a (Doc a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods toContext :: Doc a -> Context a Source # toVal :: Doc a -> Val a Source #
ToContext a (Context a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods toContext :: Context a -> Context a Source # toVal :: Context a -> Val a Source #
ToContext a (Val a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods toContext :: Val a -> Context a Source # toVal :: Val a -> Val a Source #
ToContext a b => ToContext a [b] Source # |
Instance details Defined in Text.DocTemplates.Internal Methods toContext :: [b] -> Context a Source # toVal :: [b] -> Val a Source #
ToContext a b => ToContext a (Map Text b) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods toContext :: Map Text b -> Context a Source # toVal :: Map Text b -> Val a Source #
TemplateTarget [a] => ToContext [a] [a] Source # |
Instance details Defined in Text.DocTemplates.Internal Methods toContext :: [a] -> Context [a] Source # toVal :: [a] -> Val [a] Source #

class FromContext a b where Source #

The `FromContext` class provides functions for extracting values from `Val` and `Context`.

Minimal complete definition

fromVal

Methods

fromVal :: Val a -> Maybe b Source #

lookupContext :: Text -> Context a -> Maybe b Source #

#### Instances

Instances details

TemplateTarget a => FromContext a a Source # |
Instance details Defined in Text.DocTemplates.Internal Methods fromVal :: Val a -> Maybe a Source # lookupContext :: Text -> Context a -> Maybe a Source #
TemplateTarget a => FromContext a (Doc a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods fromVal :: Val a -> Maybe (Doc a) Source # lookupContext :: Text -> Context a -> Maybe (Doc a) Source #
TemplateTarget a => FromContext a (Val a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods fromVal :: Val a -> Maybe (Val a) Source # lookupContext :: Text -> Context a -> Maybe (Val a) Source #
FromContext a b => FromContext a [b] Source # |
Instance details Defined in Text.DocTemplates.Internal Methods fromVal :: Val a -> Maybe [b] Source # lookupContext :: Text -> Context a -> Maybe [b] Source #
TemplateTarget [a] => FromContext [a] [a] Source # |
Instance details Defined in Text.DocTemplates.Internal Methods fromVal :: Val [a] -> Maybe [a] Source # lookupContext :: Text -> Context [a] -> Maybe [a] Source #

type TemplateTarget a = (HasChars a, ToText a, FromText a) Source #

data Template a Source #

A template.

Constructors

Interpolate Variable |
Conditional Variable (Template a) (Template a) |
Iterate Variable (Template a) (Template a) |
Nested (Template a) |
Partial [Pipe] (Template a) |
Literal (Doc a) |
Concat (Template a) (Template a) |
Empty |

#### Instances

Instances details

Functor Template Source # |
Instance details Defined in Text.DocTemplates.Internal Methods fmap :: (a -> b) -> Template a -> Template b Source # (<$) :: a -> Template b -> Template a Source #
Foldable Template Source # |

Instance details

Defined in Text.DocTemplates.Internal

Methods

fold :: Monoid m => Template m -> m Source #

foldMap :: Monoid m => (a -> m) -> Template a -> m Source #

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

foldr :: (a -> b -> b) -> b -> Template a -> b Source #

foldr' :: (a -> b -> b) -> b -> Template a -> b Source #

foldl :: (b -> a -> b) -> b -> Template a -> b Source #

foldl' :: (b -> a -> b) -> b -> Template a -> b Source #

foldr1 :: (a -> a -> a) -> Template a -> a Source #

foldl1 :: (a -> a -> a) -> Template a -> a Source #

toList :: Template a -> [a] Source #

null :: Template a -> Bool Source #

length :: Template a -> Int Source #

elem :: Eq a => a -> Template a -> Bool Source #

maximum :: Ord a => Template a -> a Source #

minimum :: Ord a => Template a -> a Source #

sum :: Num a => Template a -> a Source #

product :: Num a => Template a -> a Source #

Traversable Template Source # |
Instance details Defined in Text.DocTemplates.Internal Methods traverse :: Applicative f => (a -> f b) -> Template a -> f (Template b) Source # sequenceA :: Applicative f => Template (f a) -> f (Template a) Source # mapM :: Monad m => (a -> m b) -> Template a -> m (Template b) Source # sequence :: Monad m => Template (m a) -> m (Template a) Source #
Semigroup a => Monoid (Template a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods mempty :: Template a Source # mappend :: Template a -> Template a -> Template a Source # mconcat :: [Template a] -> Template a Source #
Semigroup a => Semigroup (Template a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods (<>) :: Template a -> Template a -> Template a Source # sconcat :: NonEmpty (Template a) -> Template a Source # stimes :: Integral b => b -> Template a -> Template a Source #
Data a => Data (Template a) Source # |

Instance details

Defined in Text.DocTemplates.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Template a -> c (Template a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Template a) Source #

toConstr :: Template a -> Constr Source #

dataTypeOf :: Template a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Template a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Template a)) Source #

gmapT :: (forall b. Data b => b -> b) -> Template a -> Template a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Template a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Template a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Template a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Template a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Template a -> m (Template a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Template a -> m (Template a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Template a -> m (Template a) Source #

Generic (Template a) Source # |

Instance details

Defined in Text.DocTemplates.Internal

Associated Types

type Rep (Template a) |

Instance details

Defined in Text.DocTemplates.Internal

type Rep (Template a) = D1 ('MetaData "Template" "Text.DocTemplates.Internal" "doctemplates-0.11.0.1-D1ix9osNqlP9wO3nyCLxCL" 'False) (((C1 ('MetaCons "Interpolate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Variable)) :+: C1 ('MetaCons "Conditional" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Variable) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a))))) :+: (C1 ('MetaCons "Iterate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Variable) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a)))) :+: C1 ('MetaCons "Nested" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a))))) :+: ((C1 ('MetaCons "Partial" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Pipe]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a))) :+: C1 ('MetaCons "Literal" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc a)))) :+: (C1 ('MetaCons "Concat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a))) :+: C1 ('MetaCons "Empty" 'PrefixI 'False) (U1 :: Type -> Type))))

Methods

from :: Template a -> Rep (Template a) x Source #

to :: Rep (Template a) x -> Template a Source #

Read a => Read (Template a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods readsPrec :: Int -> ReadS (Template a) Source # readList :: ReadS [Template a] Source # readPrec :: ReadPrec (Template a) Source # readListPrec :: ReadPrec [Template a] Source #
Show a => Show (Template a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods showsPrec :: Int -> Template a -> ShowS Source # show :: Template a -> String Source # showList :: [Template a] -> ShowS Source #
Eq a => Eq (Template a) Source # |
Instance details Defined in Text.DocTemplates.Internal Methods (==) :: Template a -> Template a -> Bool Source # (/=) :: Template a -> Template a -> Bool Source #
Ord a => Ord (Template a) Source # |

Instance details

Defined in Text.DocTemplates.Internal

Methods

compare :: Template a -> Template a -> Ordering Source #

(<) :: Template a -> Template a -> Bool Source #

(<=) :: Template a -> Template a -> Bool Source #

(>) :: Template a -> Template a -> Bool Source #

(>=) :: Template a -> Template a -> Bool Source #

max :: Template a -> Template a -> Template a Source #

min :: Template a -> Template a -> Template a Source #

type Rep (Template a) Source # |

Instance details

Defined in Text.DocTemplates.Internal

type Rep (Template a) = D1 ('MetaData "Template" "Text.DocTemplates.Internal" "doctemplates-0.11.0.1-D1ix9osNqlP9wO3nyCLxCL" 'False) (((C1 ('MetaCons "Interpolate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Variable)) :+: C1 ('MetaCons "Conditional" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Variable) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a))))) :+: (C1 ('MetaCons "Iterate" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Variable) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a)))) :+: C1 ('MetaCons "Nested" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a))))) :+: ((C1 ('MetaCons "Partial" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Pipe]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a))) :+: C1 ('MetaCons "Literal" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc a)))) :+: (C1 ('MetaCons "Concat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Template a))) :+: C1 ('MetaCons "Empty" 'PrefixI 'False) (U1 :: Type -> Type))))

data Variable Source #

A variable which may have several parts (`foo.bar.baz`).

Constructors

Variable |

Fields

- varParts :: [Text]
- varPipes :: [Pipe]

#### Instances

Instances details

Monoid Variable Source # |
Instance details Defined in Text.DocTemplates.Internal Methods mempty :: Variable Source # mappend :: Variable -> Variable -> Variable Source # mconcat :: [Variable] -> Variable Source #
Semigroup Variable Source # |
Instance details Defined in Text.DocTemplates.Internal Methods (<>) :: Variable -> Variable -> Variable Source # sconcat :: NonEmpty Variable -> Variable Source # stimes :: Integral b => b -> Variable -> Variable Source #
Data Variable Source # |

Instance details

Defined in Text.DocTemplates.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Variable -> c Variable Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Variable Source #

toConstr :: Variable -> Constr Source #

dataTypeOf :: Variable -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Variable) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Variable) Source #

gmapT :: (forall b. Data b => b -> b) -> Variable -> Variable Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Variable -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Variable -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Variable -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Variable -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Variable -> m Variable Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Variable -> m Variable Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Variable -> m Variable Source #

Generic Variable Source # |

Instance details

Defined in Text.DocTemplates.Internal

Associated Types

type Rep Variable |

Instance details

Defined in Text.DocTemplates.Internal

type Rep Variable = D1 ('MetaData "Variable" "Text.DocTemplates.Internal" "doctemplates-0.11.0.1-D1ix9osNqlP9wO3nyCLxCL" 'False) (C1 ('MetaCons "Variable" 'PrefixI 'True) (S1 ('MetaSel ('Just "varParts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text]) :*: S1 ('MetaSel ('Just "varPipes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Pipe])))

Methods

from :: Variable -> Rep Variable x Source #

to :: Rep Variable x -> Variable Source #

Read Variable Source # |
Instance details Defined in Text.DocTemplates.Internal Methods readsPrec :: Int -> ReadS Variable Source # readList :: ReadS [Variable] Source # readPrec :: ReadPrec Variable Source # readListPrec :: ReadPrec [Variable] Source #
Show Variable Source # |
Instance details Defined in Text.DocTemplates.Internal Methods showsPrec :: Int -> Variable -> ShowS Source # show :: Variable -> String Source # showList :: [Variable] -> ShowS Source #
Eq Variable Source # |
Instance details Defined in Text.DocTemplates.Internal Methods (==) :: Variable -> Variable -> Bool Source # (/=) :: Variable -> Variable -> Bool Source #
Ord Variable Source # |
Instance details Defined in Text.DocTemplates.Internal Methods compare :: Variable -> Variable -> Ordering Source # (<) :: Variable -> Variable -> Bool Source # (<=) :: Variable -> Variable -> Bool Source # (>) :: Variable -> Variable -> Bool Source # (>=) :: Variable -> Variable -> Bool Source # max :: Variable -> Variable -> Variable Source # min :: Variable -> Variable -> Variable Source #
type Rep Variable Source # |

Instance details

Defined in Text.DocTemplates.Internal

type Rep Variable = D1 ('MetaData "Variable" "Text.DocTemplates.Internal" "doctemplates-0.11.0.1-D1ix9osNqlP9wO3nyCLxCL" 'False) (C1 ('MetaCons "Variable" 'PrefixI 'True) (S1 ('MetaSel ('Just "varParts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text]) :*: S1 ('MetaSel ('Just "varPipes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Pipe])))

data Pipe Source #

Constructors

ToPairs |
ToUppercase |
ToLowercase |
ToLength |
Reverse |
FirstItem |
LastItem |
Rest |
AllButLast |
Chomp |
ToAlpha |
ToRoman |
NoWrap |
Block Alignment Int Border |

#### Instances

Instances details

Data Pipe Source # |

Instance details

Defined in Text.DocTemplates.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Pipe -> c Pipe Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Pipe Source #

toConstr :: Pipe -> Constr Source #

dataTypeOf :: Pipe -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Pipe) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pipe) Source #

gmapT :: (forall b. Data b => b -> b) -> Pipe -> Pipe Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pipe -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pipe -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Pipe -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Pipe -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pipe -> m Pipe Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pipe -> m Pipe Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pipe -> m Pipe Source #

Generic Pipe Source # |

Instance details

Defined in Text.DocTemplates.Internal

Associated Types

type Rep Pipe |

Instance details

Defined in Text.DocTemplates.Internal

type Rep Pipe = D1 ('MetaData "Pipe" "Text.DocTemplates.Internal" "doctemplates-0.11.0.1-D1ix9osNqlP9wO3nyCLxCL" 'False) (((C1 ('MetaCons "ToPairs" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ToUppercase" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ToLowercase" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ToLength" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Reverse" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "FirstItem" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LastItem" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "Rest" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "AllButLast" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Chomp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ToAlpha" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ToRoman" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NoWrap" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Block" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Alignment) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Border)))))))

Methods

from :: Pipe -> Rep Pipe x Source #

to :: Rep Pipe x -> Pipe Source #

Read Pipe Source # |
Instance details Defined in Text.DocTemplates.Internal Methods readsPrec :: Int -> ReadS Pipe Source # readList :: ReadS [Pipe] Source # readPrec :: ReadPrec Pipe Source # readListPrec :: ReadPrec [Pipe] Source #
Show Pipe Source # |
Instance details Defined in Text.DocTemplates.Internal Methods showsPrec :: Int -> Pipe -> ShowS Source # show :: Pipe -> String Source # showList :: [Pipe] -> ShowS Source #
Eq Pipe Source # |
Instance details Defined in Text.DocTemplates.Internal Methods (==) :: Pipe -> Pipe -> Bool Source # (/=) :: Pipe -> Pipe -> Bool Source #
Ord Pipe Source # |
Instance details Defined in Text.DocTemplates.Internal Methods compare :: Pipe -> Pipe -> Ordering Source # (<) :: Pipe -> Pipe -> Bool Source # (<=) :: Pipe -> Pipe -> Bool Source # (>) :: Pipe -> Pipe -> Bool Source # (>=) :: Pipe -> Pipe -> Bool Source # max :: Pipe -> Pipe -> Pipe Source # min :: Pipe -> Pipe -> Pipe Source #
type Rep Pipe Source # |

Instance details

Defined in Text.DocTemplates.Internal

type Rep Pipe = D1 ('MetaData "Pipe" "Text.DocTemplates.Internal" "doctemplates-0.11.0.1-D1ix9osNqlP9wO3nyCLxCL" 'False) (((C1 ('MetaCons "ToPairs" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ToUppercase" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ToLowercase" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ToLength" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Reverse" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "FirstItem" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LastItem" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "Rest" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "AllButLast" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Chomp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ToAlpha" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ToRoman" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NoWrap" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Block" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Alignment) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Border)))))))

data Alignment Source #

Constructors

LeftAligned |
Centered |
RightAligned |

#### Instances

Instances details

Data Alignment Source # |

Instance details

Defined in Text.DocTemplates.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Alignment -> c Alignment Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Alignment Source #

toConstr :: Alignment -> Constr Source #

dataTypeOf :: Alignment -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Alignment) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Alignment) Source #

gmapT :: (forall b. Data b => b -> b) -> Alignment -> Alignment Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Alignment -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Alignment -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Alignment -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Alignment -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Alignment -> m Alignment Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Alignment -> m Alignment Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Alignment -> m Alignment Source #

Generic Alignment Source # |

Instance details

Defined in Text.DocTemplates.Internal

Associated Types

type Rep Alignment |
Instance details Defined in Text.DocTemplates.Internal type Rep Alignment = D1 ('MetaData "Alignment" "Text.DocTemplates.Internal" "doctemplates-0.11.0.1-D1ix9osNqlP9wO3nyCLxCL" 'False) (C1 ('MetaCons "LeftAligned" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Centered" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RightAligned" 'PrefixI 'False) (U1 :: Type -> Type)))

Methods

from :: Alignment -> Rep Alignment x Source #

to :: Rep Alignment x -> Alignment Source #

Read Alignment Source # |
Instance details Defined in Text.DocTemplates.Internal Methods readsPrec :: Int -> ReadS Alignment Source # readList :: ReadS [Alignment] Source # readPrec :: ReadPrec Alignment Source # readListPrec :: ReadPrec [Alignment] Source #
Show Alignment Source # |
Instance details Defined in Text.DocTemplates.Internal Methods showsPrec :: Int -> Alignment -> ShowS Source # show :: Alignment -> String Source # showList :: [Alignment] -> ShowS Source #
Eq Alignment Source # |
Instance details Defined in Text.DocTemplates.Internal Methods (==) :: Alignment -> Alignment -> Bool Source # (/=) :: Alignment -> Alignment -> Bool Source #
Ord Alignment Source # |

Instance details

Defined in Text.DocTemplates.Internal

Methods

compare :: Alignment -> Alignment -> Ordering Source #

(<) :: Alignment -> Alignment -> Bool Source #

(<=) :: Alignment -> Alignment -> Bool Source #

(>) :: Alignment -> Alignment -> Bool Source #

(>=) :: Alignment -> Alignment -> Bool Source #

max :: Alignment -> Alignment -> Alignment Source #

min :: Alignment -> Alignment -> Alignment Source #

type Rep Alignment Source # |
Instance details Defined in Text.DocTemplates.Internal type Rep Alignment = D1 ('MetaData "Alignment" "Text.DocTemplates.Internal" "doctemplates-0.11.0.1-D1ix9osNqlP9wO3nyCLxCL" 'False) (C1 ('MetaCons "LeftAligned" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Centered" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RightAligned" 'PrefixI 'False) (U1 :: Type -> Type)))

data Border Source #

Constructors

Border |

Fields

- borderLeft :: Text
- borderRight :: Text

#### Instances

Instances details

Data Border Source # |

Instance details

Defined in Text.DocTemplates.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Border -> c Border Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Border Source #

toConstr :: Border -> Constr Source #

dataTypeOf :: Border -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Border) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Border) Source #

gmapT :: (forall b. Data b => b -> b) -> Border -> Border Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Border -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Border -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Border -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Border -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Border -> m Border Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Border -> m Border Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Border -> m Border Source #

Generic Border Source # |

Instance details

Defined in Text.DocTemplates.Internal

Associated Types

type Rep Border |

Instance details

Defined in Text.DocTemplates.Internal

type Rep Border = D1 ('MetaData "Border" "Text.DocTemplates.Internal" "doctemplates-0.11.0.1-D1ix9osNqlP9wO3nyCLxCL" 'False) (C1 ('MetaCons "Border" 'PrefixI 'True) (S1 ('MetaSel ('Just "borderLeft") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "borderRight") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

Methods

from :: Border -> Rep Border x Source #

to :: Rep Border x -> Border Source #

Read Border Source # |
Instance details Defined in Text.DocTemplates.Internal Methods readsPrec :: Int -> ReadS Border Source # readList :: ReadS [Border] Source # readPrec :: ReadPrec Border Source # readListPrec :: ReadPrec [Border] Source #
Show Border Source # |
Instance details Defined in Text.DocTemplates.Internal Methods showsPrec :: Int -> Border -> ShowS Source # show :: Border -> String Source # showList :: [Border] -> ShowS Source #
Eq Border Source # |
Instance details Defined in Text.DocTemplates.Internal Methods (==) :: Border -> Border -> Bool Source # (/=) :: Border -> Border -> Bool Source #
Ord Border Source # |
Instance details Defined in Text.DocTemplates.Internal Methods compare :: Border -> Border -> Ordering Source # (<) :: Border -> Border -> Bool Source # (<=) :: Border -> Border -> Bool Source # (>) :: Border -> Border -> Bool Source # (>=) :: Border -> Border -> Bool Source # max :: Border -> Border -> Border Source # min :: Border -> Border -> Border Source #
type Rep Border Source # |

Instance details

Defined in Text.DocTemplates.Internal

type Rep Border = D1 ('MetaData "Border" "Text.DocTemplates.Internal" "doctemplates-0.11.0.1-D1ix9osNqlP9wO3nyCLxCL" 'False) (C1 ('MetaCons "Border" 'PrefixI 'True) (S1 ('MetaSel ('Just "borderLeft") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "borderRight") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))