Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Template Haskell script to promote a type family to first class.
Synopsis
- fcfify :: Name -> Q [Dec]
- promoteFamily :: Name -> Q (Type, Int)
- promoteNDFamily :: Name -> Q (Type, Int)
- familyName :: Name -> Type
- applyFamily :: Name -> [Q Type] -> Q Type
- consTuple :: [Type] -> Type
- paramsProxy :: Name -> Q Type
- isTypeFamily :: Name -> Q Bool
- isTypeSynonym :: Name -> Q Bool
- isTypeFamilyOrSynonym :: Name -> Q Bool
Generate boilerplate
fcfify :: Name -> Q [Dec] Source #
Generate the boilerplate needed to promote a type family to first class.
See Fcf.Family for details on the encoding.
Using promoted families
applyFamily :: Name -> [Q Type] -> Q Type Source #
Apply a promoted family.
If there are more arguments than the arity of the family (as returned by promoteFamily
),
they are split and applied properly:
the family's main arguments are collected in a consTuple
and
the rest are applied with AppT
.
If there are fewer arguments than the arity, the result is nonsense.