deriving-compat-0.5.6: Backports of GHC deriving extensions

Copyright | (C) 2015-2017 Ryan Scott
License | BSD-style (see the file LICENSE)
Maintainer | Ryan Scott
Portability | Template Haskell
Safe Haskell | None
Language | Haskell2010

Data.Deriving.Internal

Description

Template Haskell-related utilities.

Note: this is an internal module, and as such, the API presented here is not guaranteed to be stable, even between minor releases of this library.

Synopsis

- applySubstitutionKind :: Map Name Kind -> Type -> Type
- substNameWithKind :: Name -> Kind -> Type -> Type
- substNamesWithKindStar :: [Name] -> Type -> Type
- data Via a b
- fmapConst :: f b -> (a -> b) -> f a -> f b
- foldrConst :: b -> (a -> b -> b) -> b -> t a -> b
- foldMapConst :: m -> (a -> m) -> t a -> m
- traverseConst :: f (t b) -> (a -> f b) -> t a -> f (t b)
- eqConst :: Bool -> a -> a -> Bool
- eq1Const :: Bool -> f a -> f a -> Bool
- liftEqConst :: Bool -> (a -> b -> Bool) -> f a -> f b -> Bool
- liftEq2Const :: Bool -> (a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool
- compareConst :: Ordering -> a -> a -> Ordering
- ltConst :: Bool -> a -> a -> Bool
- compare1Const :: Ordering -> f a -> f a -> Ordering
- liftCompareConst :: Ordering -> (a -> b -> Ordering) -> f a -> f b -> Ordering
- liftCompare2Const :: Ordering -> (a -> b -> Ordering) -> (c -> d -> Ordering) -> f a c -> f b d -> Ordering
- readsPrecConst :: ReadS a -> Int -> ReadS a
- readPrecConst :: ReadPrec a -> ReadPrec a
- readsPrec1Const :: ReadS (f a) -> Int -> ReadS (f a)
- liftReadsPrecConst :: ReadS (f a) -> (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a)
- liftReadPrecConst :: ReadPrec (f a) -> ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
- liftReadsPrec2Const :: ReadS (f a b) -> (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (f a b)
- liftReadPrec2Const :: ReadPrec (f a b) -> ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b)
- showsPrecConst :: ShowS -> Int -> a -> ShowS
- showsPrec1Const :: ShowS -> Int -> f a -> ShowS
- liftShowsPrecConst :: ShowS -> (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
- liftShowsPrec2Const :: ShowS -> (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> f a b -> ShowS
- data StarKindStatus
  - = NotKindStar
  - | KindStar
  - | IsKindVar Name
- canRealizeKindStar :: Type -> StarKindStatus
- starKindStatusToName :: StarKindStatus -> Maybe Name
- catKindVarNames :: [StarKindStatus] -> [Name]
- class ClassRep a where
  - arity :: a -> Int
  - allowExQuant :: a -> Bool
  - fullClassName :: a -> Name
  - classConstraint :: a -> Int -> Maybe Name
- buildTypeInstance :: ClassRep a => a -> Name -> Cxt -> [Type] -> DatatypeVariant -> Q (Cxt, Type)
- deriveConstraint :: ClassRep a => a -> Type -> (Maybe Pred, [Name])
- checkExistentialContext :: ClassRep a => a -> TyVarMap b -> Cxt -> Name -> Q c -> Q c
- noConstructorsError :: Q a
- derivingKindError :: ClassRep a => a -> Name -> Q b
- contravarianceError :: Name -> Q a
- noFunctionsError :: Name -> Q a
- etaReductionError :: Type -> Q a
- datatypeContextError :: Name -> Type -> Q a
- existentialContextError :: Name -> Q a
- outOfPlaceTyVarError :: ClassRep a => a -> Name -> Q b
- enumerationError :: String -> Q a
- enumerationOrProductError :: String -> Q a
- enumerationErrorStr :: String -> String
- type TyVarMap a = Map Name (OneOrTwoNames a)
- type TyVarMap1 = TyVarMap One
- type TyVarMap2 = TyVarMap Two
- data OneOrTwoNames a where
  - OneName :: Name -> OneOrTwoNames One
  - TwoNames :: Name -> Name -> OneOrTwoNames Two
- data One
- data Two
- interleave :: [a] -> [a] -> [a]
- isTrue# :: Int# -> Bool
- isRight :: Either l r -> Bool
- fromEither :: Either a a -> a
- filterByList :: [Bool] -> [a] -> [a]
- filterByLists :: [Bool] -> [a] -> [a] -> [a]
- partitionByList :: [Bool] -> [a] -> ([a], [a])
- appEitherE :: Q (Either Exp Exp) -> Q Exp -> Q (Either Exp Exp)
- integerE :: Int -> Q Exp
- hasKindStar :: Type -> Bool
- isStarOrVar :: Kind -> Bool
- hasKindVarChain :: Int -> Type -> Maybe [Name]
- tyKind :: Type -> Kind
- zipWithAndUnzipM :: Monad m => (a -> b -> m (c, d)) -> [a] -> [b] -> m ([c], [d])
- zipWith3AndUnzipM :: Monad m => (a -> b -> c -> m (d, e)) -> [a] -> [b] -> [c] -> m ([d], [e])
- thd3 :: (a, b, c) -> c
- unsnoc :: [a] -> Maybe ([a], a)
- isNullaryCon :: ConstructorInfo -> Bool
- conArity :: ConstructorInfo -> Int
- isProductType :: [ConstructorInfo] -> Bool
- isEnumerationType :: [ConstructorInfo] -> Bool
- isVanillaCon :: ConstructorInfo -> Bool
- newNameList :: String -> Int -> Q [Name]
- tvbKind :: TyVarBndr -> Kind
- tvbToType :: TyVarBndr -> Type
- applyClass :: Name -> Name -> Pred
- createKindChain :: Int -> Kind
- canEtaReduce :: [Type] -> [Type] -> Bool
- conTToName :: Type -> Name
- varTToName_maybe :: Type -> Maybe Name
- varTToName :: Type -> Name
- unSigT :: Type -> Type
- isTyVar :: Type -> Bool
- isTyFamily :: Type -> Q Bool
- allDistinct :: Ord a => [a] -> Bool
- mentionsName :: Type -> [Name] -> Bool
- predMentionsName :: Pred -> [Name] -> Bool
- applyTy :: Type -> [Type] -> Type
- applyTyCon :: Name -> [Type] -> Type
- unapplyTy :: Type -> [Type]
- uncurryTy :: Type -> (Cxt, [Type])
- uncurryKind :: Kind -> [Kind]
- untagExpr :: [(Name, Name)] -> Q Exp -> Q Exp
- tag2ConExpr :: Type -> Q Exp
- primOrdFunTbl :: Map Name (Name, Name, Name, Name, Name)
- removeClassApp :: Type -> Type
- freshen :: Name -> Q Name
- freshenType :: Type -> Q Type
- requiredTyVarsOfType :: Type -> [TyVarBndr]
- enumFromToExpr :: Q Exp -> Q Exp -> Q Exp
- primOpAppExpr :: Q Exp -> Name -> Q Exp -> Q Exp
- isNonUnitTuple :: Name -> Bool
- isNonUnitTupleString :: String -> Bool
- isInfixDataCon :: String -> Bool
- isSym :: String -> Bool
- ghc7'8OrLater :: Bool
- derivingCompatPackageKey :: String
- mkDerivingCompatName_v :: String -> Name
- mkDerivingCompatName_tc :: String -> Name
- isTrueHashValName :: Name
- fmapConstValName :: Name
- foldrConstValName :: Name
- foldMapConstValName :: Name
- traverseConstValName :: Name
- eqConstValName :: Name
- eq1ConstValName :: Name
- liftEqConstValName :: Name
- liftEq2ConstValName :: Name
- compareConstValName :: Name
- ltConstValName :: Name
- compare1ConstValName :: Name
- liftCompareConstValName :: Name
- liftCompare2ConstValName :: Name
- readsPrecConstValName :: Name
- readPrecConstValName :: Name
- readsPrec1ConstValName :: Name
- liftReadsPrecConstValName :: Name
- liftReadPrecConstValName :: Name
- liftReadsPrec2ConstValName :: Name
- liftReadPrec2ConstValName :: Name
- showsPrecConstValName :: Name
- showsPrec1ConstValName :: Name
- liftShowsPrecConstValName :: Name
- liftShowsPrec2ConstValName :: Name
- viaTypeName :: Name
- cHashDataName :: Name
- dHashDataName :: Name
- fHashDataName :: Name
- identDataName :: Name
- iHashDataName :: Name
- puncDataName :: Name
- symbolDataName :: Name
- wrapMonadDataName :: Name
- addrHashTypeName :: Name
- boundedTypeName :: Name
- charHashTypeName :: Name
- doubleHashTypeName :: Name
- enumTypeName :: Name
- floatHashTypeName :: Name
- foldableTypeName :: Name
- functorTypeName :: Name
- intTypeName :: Name
- intHashTypeName :: Name
- ixTypeName :: Name
- readTypeName :: Name
- showTypeName :: Name
- traversableTypeName :: Name
- wordHashTypeName :: Name
- altValName :: Name
- appendValName :: Name
- chooseValName :: Name
- coerceValName :: Name
- composeValName :: Name
- constValName :: Name
- enumFromValName :: Name
- enumFromThenValName :: Name
- enumFromThenToValName :: Name
- enumFromToValName :: Name
- eqAddrHashValName :: Name
- eqCharHashValName :: Name
- eqDoubleHashValName :: Name
- eqFloatHashValName :: Name
- eqIntHashValName :: Name
- eqWordHashValName :: Name
- errorValName :: Name
- flipValName :: Name
- fmapValName :: Name
- foldrValName :: Name
- foldMapValName :: Name
- fromEnumValName :: Name
- geAddrHashValName :: Name
- geCharHashValName :: Name
- geDoubleHashValName :: Name
- geFloatHashValName :: Name
- geIntHashValName :: Name
- getTagValName :: Name
- geWordHashValName :: Name
- gtAddrHashValName :: Name
- gtCharHashValName :: Name
- gtDoubleHashValName :: Name
- gtFloatHashValName :: Name
- gtIntHashValName :: Name
- gtWordHashValName :: Name
- idValName :: Name
- indexValName :: Name
- inRangeValName :: Name
- leAddrHashValName :: Name
- leCharHashValName :: Name
- leDoubleHashValName :: Name
- leFloatHashValName :: Name
- leIntHashValName :: Name
- leWordHashValName :: Name
- liftReadListPrecDefaultValName :: Name
- liftReadListPrec2DefaultValName :: Name
- liftReadListPrecValName :: Name
- liftReadListPrec2ValName :: Name
- liftReadPrecValName :: Name
- liftReadPrec2ValName :: Name
- listValName :: Name
- ltAddrHashValName :: Name
- ltCharHashValName :: Name
- ltDoubleHashValName :: Name
- ltFloatHashValName :: Name
- ltIntHashValName :: Name
- ltWordHashValName :: Name
- minBoundValName :: Name
- mapValName :: Name
- maxBoundValName :: Name
- minusIntHashValName :: Name
- parenValName :: Name
- parensValName :: Name
- pfailValName :: Name
- plusValName :: Name
- precValName :: Name
- predValName :: Name
- rangeSizeValName :: Name
- rangeValName :: Name
- readFieldHash :: String -> ReadPrec a -> ReadPrec a
- readFieldHashValName :: Name
- readListValName :: Name
- readListPrecDefaultValName :: Name
- readListPrecValName :: Name
- readPrec_to_SValName :: Name
- readPrecValName :: Name
- readS_to_PrecValName :: Name
- readsPrecValName :: Name
- resetValName :: Name
- returnValName :: Name
- seqValName :: Name
- showCharValName :: Name
- showListValName :: Name
- showListWithValName :: Name
- showParenValName :: Name
- showsPrecValName :: Name
- showSpaceValName :: Name
- showStringValName :: Name
- stepValName :: Name
- succValName :: Name
- tagToEnumHashValName :: Name
- timesValName :: Name
- toEnumValName :: Name
- traverseValName :: Name
- unsafeIndexValName :: Name
- unsafeRangeSizeValName :: Name
- unwrapMonadValName :: Name
- boolTypeName :: Name
- falseDataName :: Name
- trueDataName :: Name
- eqDataName :: Name
- gtDataName :: Name
- ltDataName :: Name
- eqTypeName :: Name
- ordTypeName :: Name
- andValName :: Name
- compareValName :: Name
- eqValName :: Name
- geValName :: Name
- gtValName :: Name
- leValName :: Name
- ltValName :: Name
- notValName :: Name
- wHashDataName :: Name
- expectPValName :: Name
- pureValName :: Name
- apValName :: Name
- liftA2ValName :: Name
- mappendValName :: Name
- memptyValName :: Name
- eq1TypeName :: Name
- eq2TypeName :: Name
- liftEqValName :: Name
- liftEq2ValName :: Name
- ord1TypeName :: Name
- ord2TypeName :: Name
- liftCompareValName :: Name
- liftCompare2ValName :: Name
- read1TypeName :: Name
- read2TypeName :: Name
- liftReadsPrecValName :: Name
- liftReadListValName :: Name
- liftReadsPrec2ValName :: Name
- liftReadList2ValName :: Name
- show1TypeName :: Name
- show2TypeName :: Name
- liftShowListValName :: Name
- liftShowsPrecValName :: Name
- liftShowList2ValName :: Name
- liftShowsPrec2ValName :: Name
- showCommaSpaceValName :: Name
- appEndoValName :: Name
- dualDataName :: Name
- endoDataName :: Name
- getDualValName :: Name
- readFieldValName :: Name
- readSymFieldValName :: Name

# Documentation

applySubstitutionKind :: Map Name Kind -> Type -> Type Source #

substNameWithKind :: Name -> Kind -> Type -> Type Source #

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

data Via a b infix 0 Source #

A type-level modifier intended to be used in conjunction with `deriveVia`. Refer to the documentation for `deriveVia` for more details.

fmapConst :: f b -> (a -> b) -> f a -> f b Source #

foldrConst :: b -> (a -> b -> b) -> b -> t a -> b Source #

foldMapConst :: m -> (a -> m) -> t a -> m Source #

traverseConst :: f (t b) -> (a -> f b) -> t a -> f (t b) Source #

eqConst :: Bool -> a -> a -> Bool Source #

eq1Const :: Bool -> f a -> f a -> Bool Source #

liftEqConst :: Bool -> (a -> b -> Bool) -> f a -> f b -> Bool Source #

liftEq2Const :: Bool -> (a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool Source #

compareConst :: Ordering -> a -> a -> Ordering Source #

ltConst :: Bool -> a -> a -> Bool Source #

compare1Const :: Ordering -> f a -> f a -> Ordering Source #

liftCompareConst :: Ordering -> (a -> b -> Ordering) -> f a -> f b -> Ordering Source #

liftCompare2Const :: Ordering -> (a -> b -> Ordering) -> (c -> d -> Ordering) -> f a c -> f b d -> Ordering Source #

readsPrecConst :: ReadS a -> Int -> ReadS a Source #

readPrecConst :: ReadPrec a -> ReadPrec a Source #

readsPrec1Const :: ReadS (f a) -> Int -> ReadS (f a) Source #

liftReadsPrecConst :: ReadS (f a) -> (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a) Source #

liftReadPrecConst :: ReadPrec (f a) -> ReadPrec a -> ReadPrec [a] -> ReadPrec (f a) Source #

liftReadsPrec2Const :: ReadS (f a b) -> (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (f a b) Source #

liftReadPrec2Const :: ReadPrec (f a b) -> ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (f a b) Source #

showsPrecConst :: ShowS -> Int -> a -> ShowS Source #

showsPrec1Const :: ShowS -> Int -> f a -> ShowS Source #

liftShowsPrecConst :: ShowS -> (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS Source #

liftShowsPrec2Const :: ShowS -> (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> f a b -> ShowS Source #

data StarKindStatus Source #

Whether a type is not of kind *, is of kind *, or is a kind variable.

Constructors

NotKindStar |
KindStar |
IsKindVar Name |

Instances

Eq StarKindStatus Source # |
Instance details Defined in Data.Deriving.Internal Methods (==) :: StarKindStatus -> StarKindStatus -> Bool Source # (/=) :: StarKindStatus -> StarKindStatus -> Bool Source #

canRealizeKindStar :: Type -> StarKindStatus Source #

Does a Type have kind * or k (for some kind variable k)?

starKindStatusToName :: StarKindStatus -> Maybe Name Source #

Returns `Just` the kind variable `Name` of a `StarKindStatus` if it exists. Otherwise, returns `Nothing`.

catKindVarNames :: [StarKindStatus] -> [Name] Source #

Concat together all of the StarKindStatuses that are IsKindVar and extract the kind variables' Names out.

class ClassRep a where Source #

Methods

arity :: a -> Int Source #

allowExQuant :: a -> Bool Source #

fullClassName :: a -> Name Source #

classConstraint :: a -> Int -> Maybe Name Source #

buildTypeInstance Source #

Arguments

:: ClassRep a |
=> a | The typeclass for which an instance should be derived
-> Name | The type constructor or data family name
-> Cxt | The datatype context
-> [Type] | The types to instantiate the instance with
-> DatatypeVariant | Are we dealing with a data family instance or not
-> Q (Cxt, Type) |

deriveConstraint :: ClassRep a => a -> Type -> (Maybe Pred, [Name]) Source #

Attempt to derive a constraint on a Type. If successful, return Just the constraint and any kind variable names constrained to *. Otherwise, return Nothing and the empty list.

See Note [Type inference in derived instances] for the heuristics used to come up with constraints.

checkExistentialContext :: ClassRep a => a -> TyVarMap b -> Cxt -> Name -> Q c -> Q c Source #

noConstructorsError :: Q a Source #

The given datatype has no constructors, and we don't know what to do with it.

derivingKindError :: ClassRep a => a -> Name -> Q b Source #

Either the given data type doesn't have enough type variables, or one of the type variables to be eta-reduced cannot realize kind *.

contravarianceError :: Name -> Q a Source #

The last type variable appeared in a contravariant position when deriving Functor.

noFunctionsError :: Name -> Q a Source #

A constructor has a function argument in a derived Foldable or Traversable instance.

etaReductionError :: Type -> Q a Source #

One of the last type variables cannot be eta-reduced (see the canEtaReduce function for the criteria it would have to meet).

datatypeContextError :: Name -> Type -> Q a Source #

The data type has a DatatypeContext which mentions one of the eta-reduced type variables.

existentialContextError :: Name -> Q a Source #

The data type has an existential constraint which mentions one of the eta-reduced type variables.

outOfPlaceTyVarError :: ClassRep a => a -> Name -> Q b Source #

The data type mentions one of the n eta-reduced type variables in a place other than the last nth positions of a data type in a constructor's field.

enumerationError :: String -> Q a Source #

enumerationOrProductError :: String -> Q a Source #

enumerationErrorStr :: String -> String Source #

type TyVarMap a = Map Name (OneOrTwoNames a) Source #

A mapping of type variable Names to their auxiliary function Names.

type TyVarMap1 = TyVarMap One Source #

type TyVarMap2 = TyVarMap Two Source #

data OneOrTwoNames a where Source #

Constructors

OneName :: Name -> OneOrTwoNames One |
TwoNames :: Name -> Name -> OneOrTwoNames Two |

data One Source #

data Two Source #

interleave :: [a] -> [a] -> [a] Source #

isTrue# :: Int# -> Bool Source #

isRight :: Either l r -> Bool Source #

Test if an `Either` value is the `Right` constructor. Provided as standard with GHC 7.8 and above.

fromEither :: Either a a -> a Source #

Pull the value out of an `Either` where both alternatives have the same type.

    \x -> fromEither (Left x ) == x
    \x -> fromEither (Right x) == x

filterByList :: [Bool] -> [a] -> [a] Source #

`filterByList` takes a list of Bools and a list of some elements and filters out these elements for which the corresponding value in the list of Bools is False. This function does not check whether the lists have equal length.

filterByLists :: [Bool] -> [a] -> [a] -> [a] Source #

`filterByLists` takes a list of Bools and two lists as input, and outputs a new list consisting of elements from the last two input lists. For each Bool in the list, if it is `True`, then it takes an element from the former list. If it is `False`, it takes an element from the latter list. The elements taken correspond to the index of the Bool in its list. For example:

    filterByLists [True, False, True, False] "abcd" "wxyz" = "axcz"

This function does not check whether the lists have equal length.

partitionByList :: [Bool] -> [a] -> ([a], [a]) Source #

`partitionByList` takes a list of Bools and a list of some elements and partitions the list according to the list of Bools. Elements corresponding to `True` go to the left; elements corresponding to `False` go to the right. For example, `partitionByList [True, False, True] [1,2,3] == ([1,3], [2])` This function does not check whether the lists have equal length.

appEitherE :: Q (Either Exp Exp) -> Q Exp -> Q (Either Exp Exp) Source #

Apply an `Either Exp Exp` expression to an `Exp` expression, preserving the `Either`-ness.

integerE :: Int -> Q Exp Source #

hasKindStar :: Type -> Bool Source #

Returns True if a Type has kind *.

isStarOrVar :: Kind -> Bool Source #

hasKindVarChain :: Int -> Type -> Maybe [Name] Source #

`hasKindVarChain n kind` Checks if `kind` is of the form k_0 -> k_1 -> ... -> k_(n-1), where k0, k1, ..., and k_(n-1) can be * or kind variables.

tyKind :: Type -> Kind Source #

If a Type is a SigT, returns its kind signature. Otherwise, return *.

zipWithAndUnzipM :: Monad m => (a -> b -> m (c, d)) -> [a] -> [b] -> m ([c], [d]) Source #

zipWith3AndUnzipM :: Monad m => (a -> b -> c -> m (d, e)) -> [a] -> [b] -> [c] -> m ([d], [e]) Source #

thd3 :: (a, b, c) -> c Source #

unsnoc :: [a] -> Maybe ([a], a) Source #

isNullaryCon :: ConstructorInfo -> Bool Source #

conArity :: ConstructorInfo -> Int Source #

Returns the number of fields for the constructor.

isProductType :: [ConstructorInfo] -> Bool Source #

Returns `True` if it's a datatype with exactly one, non-existential constructor.

isEnumerationType :: [ConstructorInfo] -> Bool Source #

Returns `True` if it's a datatype with one or more nullary, non-GADT constructors.

isVanillaCon :: ConstructorInfo -> Bool Source #

Returns `False` if we're dealing with existential quantification or GADTs.

newNameList :: String -> Int -> Q [Name] Source #

Generate a list of fresh names with a common prefix, and numbered suffixes.

tvbKind :: TyVarBndr -> Kind Source #

Extracts the kind from a TyVarBndr.

tvbToType :: TyVarBndr -> Type Source #

Convert a TyVarBndr to a Type.

applyClass :: Name -> Name -> Pred Source #

Applies a typeclass constraint to a type.

createKindChain :: Int -> Kind Source #

canEtaReduce :: [Type] -> [Type] -> Bool Source #

Checks to see if the last types in a data family instance can be safely eta- reduced (i.e., dropped), given the other types. This checks for three conditions:

1. All of the dropped types are type variables
2. All of the dropped types are distinct
3. None of the remaining types mention any of the dropped types

conTToName :: Type -> Name Source #

Extract the Name from a type constructor. If the argument Type is not a type variable, throw an error.

varTToName_maybe :: Type -> Maybe Name Source #

Extract Just the Name from a type variable. If the argument Type is not a type variable, return Nothing.

varTToName :: Type -> Name Source #

Extract the Name from a type variable. If the argument Type is not a type variable, throw an error.

unSigT :: Type -> Type Source #

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

isTyVar :: Type -> Bool Source #

Is the given type a variable?

isTyFamily :: Type -> Q Bool Source #

Is the given type a type family constructor (and not a data family constructor)?

allDistinct :: Ord a => [a] -> Bool Source #

Are all of the items in a list (which have an ordering) distinct?

This uses Set (as opposed to nub) for better asymptotic time complexity.

mentionsName :: Type -> [Name] -> Bool Source #

Does the given type mention any of the Names in the list?

predMentionsName :: Pred -> [Name] -> Bool Source #

Does an instance predicate mention any of the Names in the list?

applyTy :: Type -> [Type] -> Type Source #

Construct a type via curried application.

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

Fully applies a type constructor to its type variables.

unapplyTy :: Type -> [Type] Source #

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

    Either Int Char

would split to this:

    [Either, Int, Char]

uncurryTy :: Type -> (Cxt, [Type]) Source #

Split a type signature by the arrows on its spine. For example, this:

    forall a b. (a ~ b) => (a -> b) -> Char -> ()

would split to this:

    (a ~ b, [a -> b, Char, ()])

uncurryKind :: Kind -> [Kind] Source #

Like uncurryType, except on a kind level.

untagExpr :: [(Name, Name)] -> Q Exp -> Q Exp Source #

tag2ConExpr :: Type -> Q Exp Source #

primOrdFunTbl :: Map Name (Name, Name, Name, Name, Name) Source #

removeClassApp :: Type -> Type Source #

freshen :: Name -> Q Name Source #

freshenType :: Type -> Q Type Source #

requiredTyVarsOfType :: Type -> [TyVarBndr] Source #

Gets all of the required type variable binders mentioned in a Type.

enumFromToExpr :: Q Exp -> Q Exp -> Q Exp Source #

primOpAppExpr :: Q Exp -> Name -> Q Exp -> Q Exp Source #

isNonUnitTuple :: Name -> Bool Source #

Checks if a `Name` represents a tuple type constructor (other than '()')

isNonUnitTupleString :: String -> Bool Source #

Checks if a `String` represents a tuple (other than '()')

isInfixDataCon :: String -> Bool Source #

Checks if a `String` names a valid Haskell infix data constructor (i.e., does it begin with a colon?).

isSym :: String -> Bool Source #

ghc7'8OrLater :: Bool Source #

derivingCompatPackageKey :: String Source #

mkDerivingCompatName_v :: String -> Name Source #

mkDerivingCompatName_tc :: String -> Name Source #

isTrueHashValName :: Name Source #

fmapConstValName :: Name Source #

foldrConstValName :: Name Source #

foldMapConstValName :: Name Source #

traverseConstValName :: Name Source #

eqConstValName :: Name Source #

eq1ConstValName :: Name Source #

liftEqConstValName :: Name Source #

liftEq2ConstValName :: Name Source #

compareConstValName :: Name Source #

ltConstValName :: Name Source #

compare1ConstValName :: Name Source #

liftCompareConstValName :: Name Source #

liftCompare2ConstValName :: Name Source #

readsPrecConstValName :: Name Source #

readPrecConstValName :: Name Source #

readsPrec1ConstValName :: Name Source #

liftReadsPrecConstValName :: Name Source #

liftReadPrecConstValName :: Name Source #

liftReadsPrec2ConstValName :: Name Source #

liftReadPrec2ConstValName :: Name Source #

showsPrecConstValName :: Name Source #

showsPrec1ConstValName :: Name Source #

liftShowsPrecConstValName :: Name Source #

liftShowsPrec2ConstValName :: Name Source #

viaTypeName :: Name Source #

cHashDataName :: Name Source #

dHashDataName :: Name Source #

fHashDataName :: Name Source #

identDataName :: Name Source #

iHashDataName :: Name Source #

puncDataName :: Name Source #

symbolDataName :: Name Source #

wrapMonadDataName :: Name Source #

addrHashTypeName :: Name Source #

boundedTypeName :: Name Source #

charHashTypeName :: Name Source #

doubleHashTypeName :: Name Source #

enumTypeName :: Name Source #

floatHashTypeName :: Name Source #

foldableTypeName :: Name Source #

functorTypeName :: Name Source #

intTypeName :: Name Source #

intHashTypeName :: Name Source #

ixTypeName :: Name Source #

readTypeName :: Name Source #

showTypeName :: Name Source #

traversableTypeName :: Name Source #

wordHashTypeName :: Name Source #

altValName :: Name Source #

appendValName :: Name Source #

chooseValName :: Name Source #

coerceValName :: Name Source #

composeValName :: Name Source #

constValName :: Name Source #

enumFromValName :: Name Source #

enumFromThenValName :: Name Source #

enumFromThenToValName :: Name Source #

enumFromToValName :: Name Source #

eqAddrHashValName :: Name Source #

eqCharHashValName :: Name Source #

eqDoubleHashValName :: Name Source #

eqFloatHashValName :: Name Source #

eqIntHashValName :: Name Source #

eqWordHashValName :: Name Source #

errorValName :: Name Source #

flipValName :: Name Source #

fmapValName :: Name Source #

foldrValName :: Name Source #

foldMapValName :: Name Source #

fromEnumValName :: Name Source #

geAddrHashValName :: Name Source #

geCharHashValName :: Name Source #

geDoubleHashValName :: Name Source #

geFloatHashValName :: Name Source #

geIntHashValName :: Name Source #

getTagValName :: Name Source #

geWordHashValName :: Name Source #

gtAddrHashValName :: Name Source #

gtCharHashValName :: Name Source #

gtDoubleHashValName :: Name Source #

gtFloatHashValName :: Name Source #

gtIntHashValName :: Name Source #

gtWordHashValName :: Name Source #

idValName :: Name Source #

indexValName :: Name Source #

inRangeValName :: Name Source #

leAddrHashValName :: Name Source #

leCharHashValName :: Name Source #

leDoubleHashValName :: Name Source #

leFloatHashValName :: Name Source #

leIntHashValName :: Name Source #

leWordHashValName :: Name Source #

liftReadListPrecDefaultValName :: Name Source #

liftReadListPrec2DefaultValName :: Name Source #

liftReadListPrecValName :: Name Source #

liftReadListPrec2ValName :: Name Source #

liftReadPrecValName :: Name Source #

liftReadPrec2ValName :: Name Source #

listValName :: Name Source #

ltAddrHashValName :: Name Source #

ltCharHashValName :: Name Source #

ltDoubleHashValName :: Name Source #

ltFloatHashValName :: Name Source #

ltIntHashValName :: Name Source #

ltWordHashValName :: Name Source #

minBoundValName :: Name Source #

mapValName :: Name Source #

maxBoundValName :: Name Source #

minusIntHashValName :: Name Source #

parenValName :: Name Source #

parensValName :: Name Source #

pfailValName :: Name Source #

plusValName :: Name Source #

precValName :: Name Source #

predValName :: Name Source #

rangeSizeValName :: Name Source #

rangeValName :: Name Source #

readFieldHash :: String -> ReadPrec a -> ReadPrec a Source #

readFieldHashValName :: Name Source #

readListValName :: Name Source #

readListPrecDefaultValName :: Name Source #

readListPrecValName :: Name Source #

readPrec_to_SValName :: Name Source #

readPrecValName :: Name Source #

readS_to_PrecValName :: Name Source #

readsPrecValName :: Name Source #

resetValName :: Name Source #

returnValName :: Name Source #

seqValName :: Name Source #

showCharValName :: Name Source #

showListValName :: Name Source #

showListWithValName :: Name Source #

showParenValName :: Name Source #

showsPrecValName :: Name Source #

showSpaceValName :: Name Source #

showStringValName :: Name Source #

stepValName :: Name Source #

succValName :: Name Source #

tagToEnumHashValName :: Name Source #

timesValName :: Name Source #

toEnumValName :: Name Source #

traverseValName :: Name Source #

unsafeIndexValName :: Name Source #

unsafeRangeSizeValName :: Name Source #

unwrapMonadValName :: Name Source #

boolTypeName :: Name Source #

falseDataName :: Name Source #

trueDataName :: Name Source #

eqDataName :: Name Source #

gtDataName :: Name Source #

ltDataName :: Name Source #

eqTypeName :: Name Source #

ordTypeName :: Name Source #

andValName :: Name Source #

compareValName :: Name Source #

eqValName :: Name Source #

geValName :: Name Source #

gtValName :: Name Source #

leValName :: Name Source #

ltValName :: Name Source #

notValName :: Name Source #

wHashDataName :: Name Source #

expectPValName :: Name Source #

pureValName :: Name Source #

apValName :: Name Source #

liftA2ValName :: Name Source #

mappendValName :: Name Source #

memptyValName :: Name Source #

eq1TypeName :: Name Source #

eq2TypeName :: Name Source #

liftEqValName :: Name Source #

liftEq2ValName :: Name Source #

ord1TypeName :: Name Source #

ord2TypeName :: Name Source #

liftCompareValName :: Name Source #

liftCompare2ValName :: Name Source #

read1TypeName :: Name Source #

read2TypeName :: Name Source #

liftReadsPrecValName :: Name Source #

liftReadListValName :: Name Source #

liftReadsPrec2ValName :: Name Source #

liftReadList2ValName :: Name Source #

show1TypeName :: Name Source #

show2TypeName :: Name Source #

liftShowListValName :: Name Source #

liftShowsPrecValName :: Name Source #

liftShowList2ValName :: Name Source #

liftShowsPrec2ValName :: Name Source #

showCommaSpaceValName :: Name Source #

appEndoValName :: Name Source #

dualDataName :: Name Source #

endoDataName :: Name Source #

getDualValName :: Name Source #

readFieldValName :: Name Source #

readSymFieldValName :: Name Source #