Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- isLabel :: TyLit -> Type -> Exp -> Dec
- newtypeConstructorIsLabel :: TyLit -> Type -> Name -> Type -> Dec
- sumConstructorIsLabel :: TyLit -> Type -> Name -> [Type] -> Dec
- enumConstructorIsLabel :: TyLit -> Type -> Name -> Dec
- tupleAdtConstructorIsLabel :: TyLit -> Type -> Name -> [Type] -> Dec
- productAccessorIsLabel :: TyLit -> Type -> Type -> Name -> Int -> Int -> Dec
- sumAccessorIsLabel :: TyLit -> Type -> Name -> [Type] -> Dec
- enumAccessorIsLabel :: TyLit -> Type -> Name -> Dec
- hasField :: TyLit -> Type -> Type -> [Clause] -> Dec
- enumHasField :: TyLit -> Type -> Name -> Dec
- sumHasField :: TyLit -> Type -> Name -> [Type] -> Dec
- productHasField :: TyLit -> Type -> Type -> Name -> Int -> Int -> Dec
IsLabel
Constructor
tupleAdtConstructorIsLabel :: TyLit -> Type -> Name -> [Type] -> Dec Source #
IsLabel
instance which converts tuple to ADT.
Accessor
HasField
hasField :: TyLit -> Type -> Type -> [Clause] -> Dec Source #
The most general template for HasField
.
:: TyLit | Field label. |
-> Type | The ADT type. |
-> Name | Name of the constructor. |
-> [Type] | Member types of that constructor. |
-> Dec |
Instance of HasField
for a constructor of a sum ADT,
projecting it into a Maybe
tuple of its members.
Generates code of the following pattern:
instance HasField "fieldLabel" sumAdt (Maybe projectionType)
- When the amount of member types is 0,
projectionType
is()
. - When the amount of member types is 1, it is that member type.
- Otherwise it is a tuple of those members.