Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone

Derive.Call.StaticMacro

Description

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

Documentation

data Call call Source #

Constructors

Call !call ![Arg] 
Instances
Show call => Show (Call call) # 
Instance details

Defined in Derive.Call.StaticMacro

Methods

showsPrec :: Int -> Call call -> ShowS #

show :: Call call -> String #

showList :: [Call call] -> ShowS #

data Arg Source #

Constructors

Var 
Given !Term 
Instances
Show Arg # 
Instance details

Defined in Derive.Call.StaticMacro

Methods

showsPrec :: Int -> Arg -> ShowS #

show :: Arg -> String #

showList :: [Arg] -> ShowS #

call :: ValCall -> [Arg] -> 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.

transformer Source #

Arguments

:: 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)