Moduleth-extras-0.0.0.8Haskell2010
Language.Haskell.TH.Extras
- 19 values
- Packageth-extras-0.0.0.8
- Exports19
- LanguageHaskell2010
- LicenceLicenseRef-PublicDomain
- SourceExtras.hs
Determines the name of a data constructor. It's an error if the Con binds more than one name (which happens in the case where you use GADT syntax, and give multiple data constructor names separated by commas in a type signature in the where clause).
WARNING: discards binders in GADTs and existentially-quantified constructors
Assuming that we're building an instance of the form C (T v_1 ... v_(n-1)) for some GADT T, this function takes a list of the variables v_1 ... v_(n-1) used in the instance head, as well as the result type of some data constructor, say T x_1 ... x_(n-1) x_n, as well as the type t of some argument to it, and substitutes any of x_i (1 <= i <= n-1) occurring in t for the corresponding v_i, taking care to avoid name capture by foralls in t.
Given the name of a type constructor, determine its full arity
Given the name of a type constructor, determine a list of type variables bound as parameters by its declaration, and the arity of the kind of type being defined (i.e. how many more arguments would need to be supplied in addition to the bound parameters in order to obtain an ordinary type of kind *). If the supplied Name is anything other than a data or newtype, produces an error.
Determine the constructors bound by a data or newtype declaration. Errors out if supplied with another sort of declaration.
Determine the arity of a data constructor.