Portability | TemplateHaskell |
---|---|
Stability | experimental |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | Trustworthy |
Lenses and Traversals for working with Template Haskell
- class HasName t where
- class HasTypeVars t where
- typeVarsEx :: Set Name -> Traversal' t Name
- class SubstType t where
- substType :: Map Name Type -> t -> t
- typeVars :: HasTypeVars t => Traversal' t Name
- substTypeVars :: HasTypeVars t => Map Name Name -> t -> t
- conFields :: Traversal' Con StrictType
- conNamedFields :: Traversal' Con VarStrictType
Documentation
Has a Name
class HasTypeVars t whereSource
Provides for the extraction of free type variables, and alpha renaming.
typeVarsEx :: Set Name -> Traversal' t NameSource
When performing substitution into this traversal you're not allowed
to substitute in a name that is bound internally or you'll violate
the Traversal
laws, when in doubt generate your names with newName
.
HasTypeVars Type | |
HasTypeVars Name | |
HasTypeVars Pred | |
HasTypeVars TyVarBndr | |
HasTypeVars Con | |
HasTypeVars t => HasTypeVars [t] |
Provides substitution for types
typeVars :: HasTypeVars t => Traversal' t NameSource
Traverse free type variables
substTypeVars :: HasTypeVars t => Map Name Name -> t -> tSource
Substitute using a map of names in for free type variables
conFields :: Traversal' Con StrictTypeSource
Provides a Traversal
of the types of each field of a constructor.
conNamedFields :: Traversal' Con VarStrictTypeSource
Traversal
of the types of the named fields of a constructor.