HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulelens-5.3.5Haskell2010

Control.Lens.Internal.TH

  • 1 type
  • 44 values
  • Packagelens-5.3.5
  • Exports45
  • LanguageHaskell2010
  • LicenceBSD-2-Clause
  • SourceTH.hs
valuetoTupleE :: [ExpQ] -> ExpQ
#

Construct a tuple value given a list of expressions.

valuetoTupleP :: [PatQ] -> PatQ
#

Construct a tuple pattern given a list of patterns.

valueunfoldType :: Type -> (Type, [Type])
#

Decompose an applied type into its individual components. For example, this:

Either Int Char

would be unfolded to this:

(ConT ''Either, [ConT ''Int, ConT ''Char])

This function ignores explicit parentheses and visible kind applications.

In an effort to prevent users from having to enable KindSignatures every time that they use lens' TH functionality, we strip off reified kind annotations from when:

  1. The kind of a type does not contain any kind variables. If it *does* contain kind variables, we want to preserve them so that we can generate type signatures that preserve the dependency order of kind and type variables. (The data types in test/T917.hs contain examples where this is important.) This will require enabling PolyKinds, but since PolyKinds implies KindSignatures, we can at least accomplish two things at once.

  2. The data type is not an instance of a data family. We make an exception for data family instances, since the presence or absence of a kind annotation can be the difference between typechecking or not. (See T917DataFam in tests/T917.hs for an example.) Moreover, the TypeFamilies extension implies KindSignatures.

valuequantifyType :: Cxt -> Type -> Type
#

Template Haskell wants type variables declared in a forall, so we find all free type variables in a given type and declare them.

valueunSigT :: Type -> Type
#

Peel off a kind signature from a Type (if it has one).