Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

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) Source # 
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 Source # 
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)