| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Language.Haskell.TH.Natural.Syntax.Datatype.Data
Description
Builder for data type declaration
Synopsis
- newData :: String -> DataBuilder () -> Q DataD
- type DataBuilder = ConstBuilder DataD
- addCon :: GenCon b => b -> DataBuilder ()
- setKind :: Type -> DataBuilder ()
- addDeriving :: Name -> DataBuilder ()
- addDeriving' :: DerivClause -> DataBuilder ()
- addContext :: forall {k} s a (step :: k). HasCxt s [a] => Q a -> Builder s step step ()
- addTypeVar :: forall {k} s (step :: k). HasTyVarBndr s [TyVarBndr BndrVis] => TypeVarName -> Builder s step step ()
- addTypeVar' :: forall {k} s vis (step :: k). HasTyVarBndr s [TyVarBndr vis] => TypeVarName -> vis -> Maybe Kind -> Builder s step step ()
Type
newData :: String -> DataBuilder () -> Q DataD Source #
Builds a new data type declaration. The first argument is the name of the data type.
type DataBuilder = ConstBuilder DataD Source #
Functions
addCon :: GenCon b => b -> DataBuilder () Source #
Add a constructor to the data type
setKind :: Type -> DataBuilder () Source #
addDeriving :: Name -> DataBuilder () Source #
Add a deriving clause using the Name of the typeclass to derive
addDeriving 'Show
addDeriving' :: DerivClause -> DataBuilder () Source #
Reexports
addContext :: forall {k} s a (step :: k). HasCxt s [a] => Q a -> Builder s step step () Source #
Add a constraint to a context
addTypeVar :: forall {k} s (step :: k). HasTyVarBndr s [TyVarBndr BndrVis] => TypeVarName -> Builder s step step () Source #
Add the type variable to the tyVarBndr list
addTypeVar' :: forall {k} s vis (step :: k). HasTyVarBndr s [TyVarBndr vis] => TypeVarName -> vis -> Maybe Kind -> Builder s step step () Source #
Same as addTypeVar, but allows setting the kind and vis of the type variable