th-reify-many-0.1.10: Recurseively reify template haskell datatype info

Safe Haskell | None
Language | Haskell2010

Language.Haskell.TH.ReifyMany.Internal

Synopsis

- isDataDec :: Dec -> Bool
- isNormalTyCon :: Dec -> Bool
- decToFieldTypes :: Dec -> [[Type]]
- conToFieldTypes :: Con -> [Type]
- typeConcreteNames :: Type -> [Name]
- decConcreteNames :: Dec -> [Name]
- data TypeclassInstance = TypeclassInstance Cxt Type [Dec]
- getInstances :: Name -> Q [TypeclassInstance]
- lookupInstance :: [TypeclassInstance] -> Name -> Maybe TypeclassInstance
- instanceMatches :: TypeclassInstance -> Name -> Bool
- unAppsT :: Type -> [Type]
- unSigT :: Type -> Type

# Documentation

isDataDec :: Dec -> Bool #

Returns `True` if the `Dec` is a `DataD` or `NewtypeD`

isNormalTyCon :: Dec -> Bool #

Returns `True` if the `Dec` is a `DataD`, `NewtypeD`, or `TySynD`.

decToFieldTypes :: Dec -> [[Type]] #

For data, newtype, and type declarations, yields a list of the types of the fields. In the case of a type synonyms, it just returns the body of the type synonym as a singleton list.

conToFieldTypes :: Con -> [Type] #

Returns the types of the fields of the constructor.

typeConcreteNames :: Type -> [Name] #

Returns the names of all type constructors which aren't involved in constraints.

decConcreteNames :: Dec -> [Name] #

Returns the names of all type constructors used when defining type constructors.

data TypeclassInstance #

Datatype to capture the fields of `InstanceD`.

Constructors

TypeclassInstance Cxt Type [Dec] |

#### Instances

Instances details

Show TypeclassInstance # |
Instance details Defined in Language.Haskell.TH.ReifyMany.Internal Methods showsPrec :: Int -> TypeclassInstance -> ShowS # show :: TypeclassInstance -> String # showList :: [TypeclassInstance] -> ShowS #

getInstances :: Name -> Q [TypeclassInstance] #

Given the `Name` of a class, yield all of the `TypeclassInstance`s, with synonyms expanded in the `Type` field.

lookupInstance :: [TypeclassInstance] -> Name -> Maybe TypeclassInstance #

Returns the first `TypeclassInstance` where `instanceMatches` returns true.

instanceMatches :: TypeclassInstance -> Name -> Bool #

Checks if the given name is the head of one of the paramaters of the given `TypeclassInstance`.

unAppsT :: Type -> [Type] #

Breaks a type application like `A b c` into [A, b, c].

unSigT :: Type -> Type #

Remove any explicit kind signatures (i.e., `SigT`s) from a `Type`.