Text.DocTemplates.Internal

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 #

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

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

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 #

#### Instances

Instances details

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

newtype Context a #

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

Constructors

Context |
Fields unContext :: Map Text (Val a)

#### Instances

Instances details

Functor Context # |
Instance details Defined in Text.DocTemplates.Internal Methods fmap :: (a -> b) -> Context a -> Context b # (<$) :: a -> Context b -> Context a #
Foldable Context # |
Instance details Defined in Text.DocTemplates.Internal Methods fold :: Monoid m => Context m -> m # foldMap :: Monoid m => (a -> m) -> Context a -> m # foldMap' :: Monoid m => (a -> m) -> Context a -> m # foldr :: (a -> b -> b) -> b -> Context a -> b # foldr' :: (a -> b -> b) -> b -> Context a -> b # foldl :: (b -> a -> b) -> b -> Context a -> b # foldl' :: (b -> a -> b) -> b -> Context a -> b # foldr1 :: (a -> a -> a) -> Context a -> a # foldl1 :: (a -> a -> a) -> Context a -> a # toList :: Context a -> [a] # null :: Context a -> Bool # length :: Context a -> Int # elem :: Eq a => a -> Context a -> Bool # maximum :: Ord a => Context a -> a # minimum :: Ord a => Context a -> a # sum :: Num a => Context a -> a # product :: Num a => Context a -> a #
Traversable Context # |
Instance details Defined in Text.DocTemplates.Internal Methods traverse :: Applicative f => (a -> f b) -> Context a -> f (Context b) # sequenceA :: Applicative f => Context (f a) -> f (Context a) # mapM :: Monad m => (a -> m b) -> Context a -> m (Context b) # sequence :: Monad m => Context (m a) -> m (Context a) #
ToContext a (Context a) # |
Instance details Defined in Text.DocTemplates.Internal Methods toContext :: Context a -> Context a # toVal :: Context a -> Val a #
TemplateTarget a => FromJSON (Context a) # |
Instance details Defined in Text.DocTemplates.Internal Methods parseJSON :: Value -> Parser (Context a) # parseJSONList :: Value -> Parser [Context a] # omittedField :: Maybe (Context a) #
TemplateTarget a => ToJSON (Context a) # |
Instance details Defined in Text.DocTemplates.Internal Methods toJSON :: Context a -> Value # toEncoding :: Context a -> Encoding # toJSONList :: [Context a] -> Value # toEncodingList :: [Context a] -> Encoding # omitField :: Context a -> Bool #
Monoid (Context a) # |
Instance details Defined in Text.DocTemplates.Internal Methods mempty :: Context a # mappend :: Context a -> Context a -> Context a # mconcat :: [Context a] -> Context a #
Semigroup (Context a) # |
Instance details Defined in Text.DocTemplates.Internal Methods (<>) :: Context a -> Context a -> Context a # sconcat :: NonEmpty (Context a) -> Context a # stimes :: Integral b => b -> Context a -> Context a #
Data a => Data (Context a) # |
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) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Context a) # toConstr :: Context a -> Constr # dataTypeOf :: Context a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Context a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Context a)) # gmapT :: (forall b. Data b => b -> b) -> Context a -> Context a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Context a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Context a -> r # gmapQ :: (forall d. Data d => d -> u) -> Context a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Context a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Context a -> m (Context a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Context a -> m (Context a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Context a -> m (Context a) #
Show a => Show (Context a) # |
Instance details Defined in Text.DocTemplates.Internal Methods showsPrec :: Int -> Context a -> ShowS # show :: Context a -> String # showList :: [Context a] -> ShowS #

data Val a #

A variable value.

Constructors

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

#### Instances

Instances details

Functor Val # |
Instance details Defined in Text.DocTemplates.Internal Methods fmap :: (a -> b) -> Val a -> Val b # (<$) :: a -> Val b -> Val a #
Foldable Val # |
Instance details Defined in Text.DocTemplates.Internal Methods fold :: Monoid m => Val m -> m # foldMap :: Monoid m => (a -> m) -> Val a -> m # foldMap' :: Monoid m => (a -> m) -> Val a -> m # foldr :: (a -> b -> b) -> b -> Val a -> b # foldr' :: (a -> b -> b) -> b -> Val a -> b # foldl :: (b -> a -> b) -> b -> Val a -> b # foldl' :: (b -> a -> b) -> b -> Val a -> b # foldr1 :: (a -> a -> a) -> Val a -> a # foldl1 :: (a -> a -> a) -> Val a -> a # toList :: Val a -> [a] # null :: Val a -> Bool # length :: Val a -> Int # elem :: Eq a => a -> Val a -> Bool # maximum :: Ord a => Val a -> a # minimum :: Ord a => Val a -> a # sum :: Num a => Val a -> a # product :: Num a => Val a -> a #
Traversable Val # |
Instance details Defined in Text.DocTemplates.Internal Methods traverse :: Applicative f => (a -> f b) -> Val a -> f (Val b) # sequenceA :: Applicative f => Val (f a) -> f (Val a) # mapM :: Monad m => (a -> m b) -> Val a -> m (Val b) # sequence :: Monad m => Val (m a) -> m (Val a) #
TemplateTarget a => FromContext a (Val a) # |
Instance details Defined in Text.DocTemplates.Internal Methods fromVal :: Val a -> Maybe (Val a) # lookupContext :: Text -> Context a -> Maybe (Val a) #
ToContext a (Val a) # |
Instance details Defined in Text.DocTemplates.Internal Methods toContext :: Val a -> Context a # toVal :: Val a -> Val a #
TemplateTarget a => FromJSON (Val a) # |
Instance details Defined in Text.DocTemplates.Internal Methods parseJSON :: Value -> Parser (Val a) # parseJSONList :: Value -> Parser [Val a] # omittedField :: Maybe (Val a) #
TemplateTarget a => ToJSON (Val a) # |
Instance details Defined in Text.DocTemplates.Internal Methods toJSON :: Val a -> Value # toEncoding :: Val a -> Encoding # toJSONList :: [Val a] -> Value # toEncodingList :: [Val a] -> Encoding # omitField :: Val a -> Bool #
Data a => Data (Val a) # |
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) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Val a) # toConstr :: Val a -> Constr # dataTypeOf :: Val a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Val a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Val a)) # gmapT :: (forall b. Data b => b -> b) -> Val a -> Val a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Val a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Val a -> r # gmapQ :: (forall d. Data d => d -> u) -> Val a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Val a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Val a -> m (Val a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Val a -> m (Val a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Val a -> m (Val a) #
Show a => Show (Val a) # |
Instance details Defined in Text.DocTemplates.Internal Methods showsPrec :: Int -> Val a -> ShowS # show :: Val a -> String # showList :: [Val a] -> ShowS #

class ToContext a b where #

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

Minimal complete definition

toVal

Methods

toContext :: b -> Context a #

toVal :: b -> Val a #

#### Instances

Instances details

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

class FromContext a b where #

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

Minimal complete definition

fromVal

Methods

fromVal :: Val a -> Maybe b #

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

#### Instances

Instances details

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

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

data Template a #

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 # |
Instance details Defined in Text.DocTemplates.Internal Methods fmap :: (a -> b) -> Template a -> Template b # (<$) :: a -> Template b -> Template a #
Foldable Template # |
Instance details Defined in Text.DocTemplates.Internal Methods fold :: Monoid m => Template m -> m # foldMap :: Monoid m => (a -> m) -> Template a -> m # foldMap' :: Monoid m => (a -> m) -> Template a -> m # foldr :: (a -> b -> b) -> b -> Template a -> b # foldr' :: (a -> b -> b) -> b -> Template a -> b # foldl :: (b -> a -> b) -> b -> Template a -> b # foldl' :: (b -> a -> b) -> b -> Template a -> b # foldr1 :: (a -> a -> a) -> Template a -> a # foldl1 :: (a -> a -> a) -> Template a -> a # toList :: Template a -> [a] # null :: Template a -> Bool # length :: Template a -> Int # elem :: Eq a => a -> Template a -> Bool # maximum :: Ord a => Template a -> a # minimum :: Ord a => Template a -> a # sum :: Num a => Template a -> a # product :: Num a => Template a -> a #
Traversable Template # |
Instance details Defined in Text.DocTemplates.Internal Methods traverse :: Applicative f => (a -> f b) -> Template a -> f (Template b) # sequenceA :: Applicative f => Template (f a) -> f (Template a) # mapM :: Monad m => (a -> m b) -> Template a -> m (Template b) # sequence :: Monad m => Template (m a) -> m (Template a) #
Semigroup a => Monoid (Template a) # |
Instance details Defined in Text.DocTemplates.Internal Methods mempty :: Template a # mappend :: Template a -> Template a -> Template a # mconcat :: [Template a] -> Template a #
Semigroup a => Semigroup (Template a) # |
Instance details Defined in Text.DocTemplates.Internal Methods (<>) :: Template a -> Template a -> Template a # sconcat :: NonEmpty (Template a) -> Template a # stimes :: Integral b => b -> Template a -> Template a #
Data a => Data (Template a) # |
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) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Template a) # toConstr :: Template a -> Constr # dataTypeOf :: Template a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Template a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Template a)) # gmapT :: (forall b. Data b => b -> b) -> Template a -> Template a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Template a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Template a -> r # gmapQ :: (forall d. Data d => d -> u) -> Template a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Template a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Template a -> m (Template a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Template a -> m (Template a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Template a -> m (Template a) #
Generic (Template a) # |
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-aFJRT5E43a4sBaDyDjoPj" '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 # to :: Rep (Template a) x -> Template a #
Read a => Read (Template a) # |
Instance details Defined in Text.DocTemplates.Internal Methods readsPrec :: Int -> ReadS (Template a) # readList :: ReadS [Template a] # readPrec :: ReadPrec (Template a) # readListPrec :: ReadPrec [Template a] #
Show a => Show (Template a) # |
Instance details Defined in Text.DocTemplates.Internal Methods showsPrec :: Int -> Template a -> ShowS # show :: Template a -> String # showList :: [Template a] -> ShowS #
Eq a => Eq (Template a) # |
Instance details Defined in Text.DocTemplates.Internal Methods (==) :: Template a -> Template a -> Bool # (/=) :: Template a -> Template a -> Bool #
Ord a => Ord (Template a) # |
Instance details Defined in Text.DocTemplates.Internal Methods compare :: Template a -> Template a -> Ordering # (<) :: Template a -> Template a -> Bool # (<=) :: Template a -> Template a -> Bool # (>) :: Template a -> Template a -> Bool # (>=) :: Template a -> Template a -> Bool # max :: Template a -> Template a -> Template a # min :: Template a -> Template a -> Template a #
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-aFJRT5E43a4sBaDyDjoPj" '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 #

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

Constructors

Variable |
Fields varParts :: [Text] varPipes :: [Pipe]

#### Instances

Instances details

Monoid Variable # |
Instance details Defined in Text.DocTemplates.Internal Methods mempty :: Variable # mappend :: Variable -> Variable -> Variable # mconcat :: [Variable] -> Variable #
Semigroup Variable # |
Instance details Defined in Text.DocTemplates.Internal Methods (<>) :: Variable -> Variable -> Variable # sconcat :: NonEmpty Variable -> Variable # stimes :: Integral b => b -> Variable -> Variable #
Data Variable # |
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Variable # toConstr :: Variable -> Constr # dataTypeOf :: Variable -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Variable) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Variable) # gmapT :: (forall b. Data b => b -> b) -> Variable -> Variable # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Variable -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Variable -> r # gmapQ :: (forall d. Data d => d -> u) -> Variable -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Variable -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Variable -> m Variable # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Variable -> m Variable # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Variable -> m Variable #
Generic Variable # |
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-aFJRT5E43a4sBaDyDjoPj" '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 # to :: Rep Variable x -> Variable #
Read Variable # |
Instance details Defined in Text.DocTemplates.Internal Methods readsPrec :: Int -> ReadS Variable # readList :: ReadS [Variable] # readPrec :: ReadPrec Variable # readListPrec :: ReadPrec [Variable] #
Show Variable # |
Instance details Defined in Text.DocTemplates.Internal Methods showsPrec :: Int -> Variable -> ShowS # show :: Variable -> String # showList :: [Variable] -> ShowS #
Eq Variable # |
Instance details Defined in Text.DocTemplates.Internal Methods (==) :: Variable -> Variable -> Bool # (/=) :: Variable -> Variable -> Bool #
Ord Variable # |
Instance details Defined in Text.DocTemplates.Internal Methods compare :: Variable -> Variable -> Ordering # (<) :: Variable -> Variable -> Bool # (<=) :: Variable -> Variable -> Bool # (>) :: Variable -> Variable -> Bool # (>=) :: Variable -> Variable -> Bool # max :: Variable -> Variable -> Variable # min :: Variable -> Variable -> Variable #
type Rep Variable # |
Instance details Defined in Text.DocTemplates.Internal type Rep Variable = D1 ('MetaData "Variable" "Text.DocTemplates.Internal" "doctemplates-0.11.0.1-aFJRT5E43a4sBaDyDjoPj" '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 #

Constructors

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

#### Instances

Instances details

Data Pipe # |
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Pipe # toConstr :: Pipe -> Constr # dataTypeOf :: Pipe -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Pipe) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pipe) # gmapT :: (forall b. Data b => b -> b) -> Pipe -> Pipe # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pipe -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pipe -> r # gmapQ :: (forall d. Data d => d -> u) -> Pipe -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Pipe -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pipe -> m Pipe # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pipe -> m Pipe # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pipe -> m Pipe #
Generic Pipe # |
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-aFJRT5E43a4sBaDyDjoPj" '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 # to :: Rep Pipe x -> Pipe #
Read Pipe # |
Instance details Defined in Text.DocTemplates.Internal Methods readsPrec :: Int -> ReadS Pipe # readList :: ReadS [Pipe] # readPrec :: ReadPrec Pipe # readListPrec :: ReadPrec [Pipe] #
Show Pipe # |
Instance details Defined in Text.DocTemplates.Internal Methods showsPrec :: Int -> Pipe -> ShowS # show :: Pipe -> String # showList :: [Pipe] -> ShowS #
Eq Pipe # |
Instance details Defined in Text.DocTemplates.Internal Methods (==) :: Pipe -> Pipe -> Bool # (/=) :: Pipe -> Pipe -> Bool #
Ord Pipe # |
Instance details Defined in Text.DocTemplates.Internal Methods compare :: Pipe -> Pipe -> Ordering # (<) :: Pipe -> Pipe -> Bool # (<=) :: Pipe -> Pipe -> Bool # (>) :: Pipe -> Pipe -> Bool # (>=) :: Pipe -> Pipe -> Bool # max :: Pipe -> Pipe -> Pipe # min :: Pipe -> Pipe -> Pipe #
type Rep Pipe # |
Instance details Defined in Text.DocTemplates.Internal type Rep Pipe = D1 ('MetaData "Pipe" "Text.DocTemplates.Internal" "doctemplates-0.11.0.1-aFJRT5E43a4sBaDyDjoPj" '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 #

Constructors

LeftAligned |
Centered |
RightAligned |

#### Instances

Instances details

Data Alignment # |
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Alignment # toConstr :: Alignment -> Constr # dataTypeOf :: Alignment -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Alignment) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Alignment) # gmapT :: (forall b. Data b => b -> b) -> Alignment -> Alignment # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Alignment -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Alignment -> r # gmapQ :: (forall d. Data d => d -> u) -> Alignment -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Alignment -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Alignment -> m Alignment # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Alignment -> m Alignment # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Alignment -> m Alignment #
Generic Alignment # |
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-aFJRT5E43a4sBaDyDjoPj" '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 # to :: Rep Alignment x -> Alignment #
Read Alignment # |
Instance details Defined in Text.DocTemplates.Internal Methods readsPrec :: Int -> ReadS Alignment # readList :: ReadS [Alignment] # readPrec :: ReadPrec Alignment # readListPrec :: ReadPrec [Alignment] #
Show Alignment # |
Instance details Defined in Text.DocTemplates.Internal Methods showsPrec :: Int -> Alignment -> ShowS # show :: Alignment -> String # showList :: [Alignment] -> ShowS #
Eq Alignment # |
Instance details Defined in Text.DocTemplates.Internal Methods (==) :: Alignment -> Alignment -> Bool # (/=) :: Alignment -> Alignment -> Bool #
Ord Alignment # |
Instance details Defined in Text.DocTemplates.Internal Methods compare :: Alignment -> Alignment -> Ordering # (<) :: Alignment -> Alignment -> Bool # (<=) :: Alignment -> Alignment -> Bool # (>) :: Alignment -> Alignment -> Bool # (>=) :: Alignment -> Alignment -> Bool # max :: Alignment -> Alignment -> Alignment # min :: Alignment -> Alignment -> Alignment #
type Rep Alignment # |
Instance details Defined in Text.DocTemplates.Internal type Rep Alignment = D1 ('MetaData "Alignment" "Text.DocTemplates.Internal" "doctemplates-0.11.0.1-aFJRT5E43a4sBaDyDjoPj" '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 #

Constructors

Border |
Fields borderLeft :: Text borderRight :: Text

#### Instances

Instances details

Data Border # |
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Border # toConstr :: Border -> Constr # dataTypeOf :: Border -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Border) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Border) # gmapT :: (forall b. Data b => b -> b) -> Border -> Border # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Border -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Border -> r # gmapQ :: (forall d. Data d => d -> u) -> Border -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Border -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Border -> m Border # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Border -> m Border # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Border -> m Border #
Generic Border # |
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-aFJRT5E43a4sBaDyDjoPj" '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 # to :: Rep Border x -> Border #
Read Border # |
Instance details Defined in Text.DocTemplates.Internal Methods readsPrec :: Int -> ReadS Border # readList :: ReadS [Border] # readPrec :: ReadPrec Border # readListPrec :: ReadPrec [Border] #
Show Border # |
Instance details Defined in Text.DocTemplates.Internal Methods showsPrec :: Int -> Border -> ShowS # show :: Border -> String # showList :: [Border] -> ShowS #
Eq Border # |
Instance details Defined in Text.DocTemplates.Internal Methods (==) :: Border -> Border -> Bool # (/=) :: Border -> Border -> Bool #
Ord Border # |
Instance details Defined in Text.DocTemplates.Internal Methods compare :: Border -> Border -> Ordering # (<) :: Border -> Border -> Bool # (<=) :: Border -> Border -> Bool # (>) :: Border -> Border -> Bool # (>=) :: Border -> Border -> Bool # max :: Border -> Border -> Border # min :: Border -> Border -> Border #
type Rep Border # |
Instance details Defined in Text.DocTemplates.Internal type Rep Border = D1 ('MetaData "Border" "Text.DocTemplates.Internal" "doctemplates-0.11.0.1-aFJRT5E43a4sBaDyDjoPj" 'False) (C1 ('MetaCons "Border" 'PrefixI 'True) (S1 ('MetaSel ('Just "borderLeft") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "borderRight") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))