fcf-family-0.1.0.0: Family of families: featherweight defunctionalization
Safe HaskellSafe-Inferred
LanguageHaskell2010

Fcf.Family.TH

Description

Template Haskell script to promote a type family to first class.

Synopsis

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

promoteFamily :: Name -> Q (Type, Int) Source #

Promote a fcfified family, returning its partially applied Family and its arity. The result can be applied to a consTuple of the appropriate size,

promoteNDFamily :: Name -> Q (Type, Int) Source #

Promote a fcfified family, returning its partially applied Family and its arity. The result can be applied to a consTuple of the appropriate size,

familyName :: Name -> Type Source #

Get the quoted fcf Name of an existing type family.

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.

consTuple :: [Type] -> Type Source #

Construct a tuple suitable for a Family argument.

Predicates

isTypeFamily :: Name -> Q Bool Source #

True if it is a type family (open or closed).

isTypeSynonym :: Name -> Q Bool Source #

True if it is a type synonym.

isTypeFamilyOrSynonym :: Name -> Q Bool Source #

True if it is a type family or synonym.