Safe Haskell | Safe-Inferred |
---|
A static macro is like a Derive.Call.Macro, except that its calls are given directly in haskell, instead of looked up as strings during evaluation. This means that the calls can't be rebound, but on the other hand, it can re-export the documentation for the sub-calls.
Synopsis
- data Call call = Call !call ![Arg]
- data Arg
- call :: ValCall -> [Arg] -> Arg
- literal :: Typecheck.ToVal a => a -> Arg
- check :: CallStack.Stack => Text -> Either Text a -> a
- generator :: CallableExpr d => Module.Module -> CallName -> Tags.Tags -> Doc.Doc -> [Call (Transformer d)] -> Call (Generator d) -> Either Text (Generator d)
- transformer :: CallableExpr d => Module.Module -> CallName -> Tags.Tags -> Doc.Doc -> [Call (Transformer d)] -> Either Text (Transformer d)
Documentation
literal :: Typecheck.ToVal a => a -> Arg Source #
check :: CallStack.Stack => Text -> Either Text a -> a Source #
Check the output of generator
, transformer
, or val
and crash if
it had a statically-detectable error. Of course I'd much rather this
were a type error, but it's not worth breaking out TH for it.
generator :: CallableExpr d => Module.Module -> CallName -> Tags.Tags -> Doc.Doc -> [Call (Transformer d)] -> Call (Generator d) -> Either Text (Generator d) Source #
Create a generator macro from a list of transformers and a generator.
:: CallableExpr d | |
=> Module.Module | |
-> CallName | |
-> Tags.Tags | |
-> Doc.Doc | |
-> [Call (Transformer d)] | Apply these transformers. This is in compose order, so the last one is applied first. |
-> Either Text (Transformer d) |