| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Language.Haskell.TH.Natural.Syntax.Func
Description
Builder for top-level function declaration
Synopsis
- newFunc :: forall (step :: BuilderStep). String -> FuncBuilder step 'Ready () -> Q [Dec]
- type FuncBuilder = Builder FuncBuilderState
- data FuncBuilderState = MkFBS {}
- addClause :: forall (step :: BuilderStep). Clause -> FuncBuilder step 'Ready ()
- bodyFromExp :: forall b (step :: BuilderStep). GenExpr b => b -> FuncBuilder step 'Ready ()
- setSignature :: forall {k} a (step :: k). GenType a => a -> FuncBuilder step step ()
- inline :: forall {k} (step :: k). FuncBuilder step step ()
- setInline :: forall {k} (step :: k). Inline -> RuleMatch -> Phases -> FuncBuilder step step ()
- addPragma :: forall {k} (step :: k). Pragma -> FuncBuilder step step ()
- pragmas :: Lens' FuncBuilderState [Pragma]
- dec :: Lens' FuncBuilderState FunD
- signature :: Lens' FuncBuilderState (Maybe SigD)
- module Language.Haskell.TH.Natural.Syntax.Builder.Monad
Builder
newFunc :: forall (step :: BuilderStep). String -> FuncBuilder step 'Ready () -> Q [Dec] Source #
Builds a function declaration. The string argument is the name of the function
type FuncBuilder = Builder FuncBuilderState Source #
State
data FuncBuilderState Source #
Functions
Clause
addClause :: forall (step :: BuilderStep). Clause -> FuncBuilder step 'Ready () Source #
Add a clause to the function
bodyFromExp :: forall b (step :: BuilderStep). GenExpr b => b -> FuncBuilder step 'Ready () Source #
Uses an Exp as the body of a function
Warning: This operation is destructive, and replaces all previous clauses set using addClause
Signature
setSignature :: forall {k} a (step :: k). GenType a => a -> FuncBuilder step step () Source #
Set the signature of the function
Pragmas
inline :: forall {k} (step :: k). FuncBuilder step step () Source #
Add an inline pragma to the function
setInline :: forall {k} (step :: k). Inline -> RuleMatch -> Phases -> FuncBuilder step step () Source #
Sets an inline pragma to the function
addPragma :: forall {k} (step :: k). Pragma -> FuncBuilder step step () Source #
Add a Pragma alongside the function declaration