optics-th-0.4: Optics construction using TemplateHaskell
Safe HaskellNone
LanguageHaskell2010

Optics.TH.Internal.Utils

Synopsis

Documentation

appsT :: TypeQ -> [TypeQ] -> TypeQ Source #

Apply arguments to a type constructor

appsE1 :: ExpQ -> [ExpQ] -> ExpQ Source #

Apply arguments to a function

toTupleT :: [TypeQ] -> TypeQ Source #

Construct a tuple type given a list of types.

toTupleE :: [ExpQ] -> ExpQ Source #

Construct a tuple value given a list of expressions.

toTupleP :: [PatQ] -> PatQ Source #

Construct a tuple pattern given a list of patterns.

conAppsT :: Name -> [Type] -> Type Source #

Apply arguments to a type constructor.

newNames Source #

Arguments

:: String

base name

-> Int

count

-> Q [Name] 

Generate many new names from a given base name.

addKindInfo' :: [Type] -> DatatypeInfo -> Type -> Type Source #

Fill in kind variables using info from datatype type parameters.

quantifyType :: [TyVarBndrSpec] -> Cxt -> Type -> Type Source #

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

quantifyType' :: Set Name -> [TyVarBndrSpec] -> Cxt -> Type -> Type Source #

This function works like quantifyType except that it takes a list of variables to exclude from quantification.

tyVarBndrToType :: TyVarBndr_ flag -> Type Source #

Transform TyVarBndr into a Type so it's suitable e.g. for freeVariablesWellScoped or type substitution.

requireExtensions :: String -> [[Extension]] -> Q () Source #

Pass in a list of lists of extensions, where any of the given extensions will satisfy it. For example, you might need either GADTs or ExistentialQuantification, so you'd write:

requireExtensions [[GADTs, ExistentialQuantification]]

But if you need TypeFamilies and MultiParamTypeClasses, then you'd write:

requireExtensions [[TypeFamilies], [MultiParamTypeClasses]]