Karya, built on 2020-11-26T21:03:17 (patch 23b5be2d53a9e8e7d6136cda5aae2849abe5cded)
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

Instances details
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

Instances details
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)