template-haskell-natural-1.0.0.0
Safe HaskellNone
LanguageHaskell2010

Language.Haskell.TH.Natural.Syntax.Signature

Description

Builder for type signatures

In Template Haskell, a signature (SigD) refers to a symbol's type signature with a Name (e.g. _length :: [a] -> Int_). Here, by _signature_, we mean just the type signature, without a name.

Synopsis

Builder

newSignature :: forall (step :: BuilderStep). SignatureBuilder step 'Ready () -> Q ForallT Source #

Builds a type signature

type SignatureBuilder (prev :: k) (next :: k) a = Builder SignatureState prev next a Source #

State

data SignatureState Source #

Constructors

MkSBS 

Instances

Instances details
GenType (SignatureBuilder step 'Ready ()) Source # 
Instance details

Defined in Language.Haskell.TH.Natural.Syntax.Signature

Methods

genTy :: SignatureBuilder step 'Ready () -> Q Type Source #

Functions

addToForall :: forall {k} (step :: k). TypeVarName -> SignatureBuilder step step () Source #

Adds the given type variable to the _forall_ list.

Using this function should comply with the 'forall-or-nothing' rule (https:/ghc.gitlab.haskell.orgghcdocusers_guideextsexplicit_forall.html#the-forall-or-nothing-rule)

addConstraint :: forall {k} a (step :: k). GenType a => a -> SignatureBuilder step step () Source #

Add the given type to the set of constraints

addParam :: forall {k} a (step :: k). GenType a => a -> SignatureBuilder step step () Source #

Set the type as the nth parameter of the function's signature

(n being the number of time addParam was called)

setResultType :: forall a (step :: BuilderStep). GenType a => a -> SignatureBuilder step 'Ready () Source #

Set the result type in the function's signature

Lenses

Re-export

newTypeVar :: forall {k} st (step :: k). String -> Builder st step step TypeVarName Source #

Builds a new type variable