Modulederiving-compat-0.6.8Haskell2010
Data.Deriving.Internal
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
- value applySubstitutionKind
- value substNameWithKind
- value substNamesWithKindStar
- data Via
- value fmapConst
- value replaceConst
- value foldrConst
- value foldMapConst
- value nullConst
- value traverseConst
- value eqConst
- value eq1Const
- value liftEqConst
- value liftEq2Const
- value compareConst
- value ltConst
- value compare1Const
- value liftCompareConst
- value liftCompare2Const
- value readsPrecConst
- value readPrecConst
- value readsPrec1Const
- value liftReadsPrecConst
- value liftReadPrecConst
- value liftReadsPrec2Const
- value liftReadPrec2Const
- value showsPrecConst
- value showsPrec1Const
- value liftShowsPrecConst
- value liftShowsPrec2Const
- data StarKindStatus
- value canRealizeKindStar
- value starKindStatusToName
- value catKindVarNames
- class ClassRep
- value buildTypeInstance
- value deriveConstraint
- value checkExistentialContext
- value noConstructorsError
- value derivingKindError
- value contravarianceError
- value noFunctionsError
- value etaReductionError
- value datatypeContextError
- value existentialContextError
- value outOfPlaceTyVarError
- value enumerationError
- value enumerationOrProductError
- value enumerationErrorStr
- value typeDataError
- type TyVarMap
- type TyVarMap1
- type TyVarMap2
- data OneOrTwoNames
- data One
- data Two
- value interleave
- value filterByList
- value filterByLists
- value partitionByList
- value integerE
- value hasKindStar
- value isStarOrVar
- value hasKindVarChain
- value tyKind
- value zipWithAndUnzipM
- value zipWith3AndUnzipM
- value thd3
- value unsnoc
- value isNullaryCon
- value conArity
- value isProductType
- value isEnumerationType
- value isVanillaCon
- value newNameList
- value tvbKind
- value tvbToType
- value applyClass
- value createKindChain
- value canEtaReduce
- value conTToName
- value varTToName_maybe
- value varTToName
- value unSigT
- value isTyVar
- value isInTypeFamilyApp
- value allDistinct
- value mentionsName
- value applyTy
- value applyTyCon
- value unapplyTy
- value uncurryTy
- value uncurryKind
- value untagExpr
- value tag2ConExpr
- value primOrdFunTbl
- value removeClassApp
- value freshen
- value freshenType
- value enumFromToExpr
- value primOpAppExpr
- value isNonUnitTuple
- value isNonUnitTupleString
- value isInfixDataCon
- value isSym
- value isTrueHashValName
- value fmapConstValName
- value replaceConstValName
- value foldrConstValName
- value foldMapConstValName
- value nullConstValName
- value traverseConstValName
- value eqConstValName
- value eq1ConstValName
- value liftEqConstValName
- value liftEq2ConstValName
- value compareConstValName
- value ltConstValName
- value compare1ConstValName
- value liftCompareConstValName
- value liftCompare2ConstValName
- value readsPrecConstValName
- value readPrecConstValName
- value readsPrec1ConstValName
- value liftReadsPrecConstValName
- value liftReadPrecConstValName
- value liftReadsPrec2ConstValName
- value liftReadPrec2ConstValName
- value showsPrecConstValName
- value showsPrec1ConstValName
- value liftShowsPrecConstValName
- value liftShowsPrec2ConstValName
- value viaTypeName
- value cHashDataName
- value dHashDataName
- value fHashDataName
- value identDataName
- value iHashDataName
- value puncDataName
- value symbolDataName
- value wrapMonadDataName
- value addrHashTypeName
- value boundedTypeName
- value charHashTypeName
- value doubleHashTypeName
- value enumTypeName
- value floatHashTypeName
- value foldableTypeName
- value functorTypeName
- value intTypeName
- value intHashTypeName
- value ixTypeName
- value readTypeName
- value showTypeName
- value traversableTypeName
- value wordHashTypeName
- value altValName
- value appendValName
- value chooseValName
- value composeValName
- value constValName
- value enumFromValName
- value enumFromThenValName
- value enumFromThenToValName
- value enumFromToValName
- value eqAddrHashValName
- value eqCharHashValName
- value eqDoubleHashValName
- value eqFloatHashValName
- value eqIntHashValName
- value eqWordHashValName
- value errorValName
- value flipValName
- value fmapValName
- value foldrValName
- value foldMapValName
- value fromEnumValName
- value geAddrHashValName
- value geCharHashValName
- value geDoubleHashValName
- value geFloatHashValName
- value geIntHashValName
- value getTagValName
- value geWordHashValName
- value gtAddrHashValName
- value gtCharHashValName
- value gtDoubleHashValName
- value gtFloatHashValName
- value gtIntHashValName
- value gtWordHashValName
- value idValName
- value indexValName
- value inRangeValName
- value leAddrHashValName
- value leCharHashValName
- value leDoubleHashValName
- value leFloatHashValName
- value leIntHashValName
- value leWordHashValName
- value listValName
- value ltAddrHashValName
- value ltCharHashValName
- value ltDoubleHashValName
- value ltFloatHashValName
- value ltIntHashValName
- value ltWordHashValName
- value minBoundValName
- value mapValName
- value maxBoundValName
- value minusIntHashValName
- value neqIntHashValName
- value parenValName
- value parensValName
- value pfailValName
- value plusValName
- value precValName
- value predValName
- value rangeSizeValName
- value rangeValName
- value readFieldHash
- value readFieldHashValName
- value readListValName
- value readListPrecDefaultValName
- value readListPrecValName
- value readPrec_to_SValName
- value readPrecValName
- value readS_to_PrecValName
- value readsPrecValName
- value replaceValName
- value resetValName
- value returnValName
- value seqValName
- value showCharValName
- value showListValName
- value showListWithValName
- value showParenValName
- value showsPrecValName
- value showSpaceValName
- value showStringValName
- value stepValName
- value succValName
- value tagToEnumHashValName
- value timesValName
- value toEnumValName
- value traverseValName
- value unsafeIndexValName
- value unsafeRangeSizeValName
- value unwrapMonadValName
- value boolTypeName
- value falseDataName
- value trueDataName
- value eqDataName
- value gtDataName
- value ltDataName
- value eqTypeName
- value ordTypeName
- value andValName
- value compareValName
- value eqValName
- value geValName
- value gtValName
- value leValName
- value ltValName
- value notValName
- value wHashDataName
- value expectPValName
- value allValName
- value apValName
- value pureValName
- value liftA2ValName
- value mappendValName
- value memptyValName
- value nullValName
- value eq1TypeName
- value ord1TypeName
- value read1TypeName
- value show1TypeName
- value eq2TypeName
- value ord2TypeName
- value read2TypeName
- value show2TypeName
- value liftEqValName
- value liftEq2ValName
- value liftCompareValName
- value liftCompare2ValName
- value liftReadsPrecValName
- value liftReadListValName
- value liftReadsPrec2ValName
- value liftReadList2ValName
- value liftShowListValName
- value liftShowsPrecValName
- value liftShowList2ValName
- value liftShowsPrec2ValName
- value coerceValName
- value liftReadListPrecDefaultValName
- value liftReadListPrec2DefaultValName
- value liftReadListPrecValName
- value liftReadListPrec2ValName
- value liftReadPrecValName
- value liftReadPrec2ValName
- value showCommaSpaceValName
- value appEndoValName
- value dualDataName
- value endoDataName
- value getDualValName
- value readFieldValName
- value readSymFieldValName
- value eqInt8HashValName
- value eqInt16HashValName
- value eqWord8HashValName
- value eqWord16HashValName
- value geInt8HashValName
- value geInt16HashValName
- value geWord8HashValName
- value geWord16HashValName
- value gtInt8HashValName
- value gtInt16HashValName
- value gtWord8HashValName
- value gtWord16HashValName
- value int8HashTypeName
- value int8ToIntHashValName
- value int16HashTypeName
- value int16ToIntHashValName
- value intToInt8HashValName
- value intToInt16HashValName
- value leInt8HashValName
- value leInt16HashValName
- value leWord8HashValName
- value leWord16HashValName
- value ltInt8HashValName
- value ltInt16HashValName
- value ltWord8HashValName
- value ltWord16HashValName
- value word8HashTypeName
- value word8ToWordHashValName
- value word16HashTypeName
- value word16ToWordHashValName
- value wordToWord8HashValName
- value wordToWord16HashValName
- value eqInt32HashValName
- value eqWord32HashValName
- value geInt32HashValName
- value geWord32HashValName
- value gtInt32HashValName
- value gtWord32HashValName
- value int32HashTypeName
- value int32ToIntHashValName
- value intToInt32HashValName
- value leInt32HashValName
- value leWord32HashValName
- value ltInt32HashValName
- value ltWord32HashValName
- value word32HashTypeName
- value word32ToWordHashValName
- value wordToWord32HashValName
- value i8HashDataName
- value i16HashDataName
- value i32HashDataName
- value i64HashDataName
- value int64HashTypeName
- value w8HashDataName
- value w16HashDataName
- value w32HashDataName
- value w64HashDataName
- value word64HashTypeName
- Packagederiving-compat-0.6.8
- Exports365
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceInternal.hs
A type-level modifier intended to be used in conjunction with deriveVia.
Refer to the documentation for deriveVia for more details.
Whether a type is not of kind *, is of kind *, or is a kind variable.
Constructors
Instances1Eq
Eq StarKindStatusDefined in deriving-compat-0.6.8 · Data.Deriving.Internal
Does a Type have kind * or k (for some kind variable k)?
Returns Just the kind variable Name of a StarKindStatus if it exists. Otherwise, returns Nothing.
Concat together all of the StarKindStatuses that are IsKindVar and extract the kind variables' Names out.
Methods
arity :: a -> IntallowExQuant :: a -> BoolfullClassName :: a -> NameclassConstraint :: a -> Int -> Maybe Name
Instances8ClassRep, …
ClassRep BoundedClassDefined in deriving-compat-0.6.8 · Data.Bounded.Deriving.InternalClassRep EnumClassDefined in deriving-compat-0.6.8 · Data.Enum.Deriving.InternalClassRep EqClassDefined in deriving-compat-0.6.8 · Data.Eq.Deriving.InternalClassRep FunctorClassDefined in deriving-compat-0.6.8 · Data.Functor.Deriving.InternalClassRep IxClassDefined in deriving-compat-0.6.8 · Data.Ix.Deriving.InternalClassRep OrdClassDefined in deriving-compat-0.6.8 · Data.Ord.Deriving.InternalClassRep ReadClassDefined in deriving-compat-0.6.8 · Text.Read.Deriving.InternalClassRep ShowClassDefined in deriving-compat-0.6.8 · Text.Show.Deriving.Internal
buildTypeInstance 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.
The given datatype has no constructors, and we don't know what to do with it.
Either the given data type doesn't have enough type variables, or one of the type variables to be eta-reduced cannot realize kind *.
The last type variable appeared in a contravariant position when deriving Functor.
A constructor has a function argument in a derived Foldable or Traversable instance.
One of the last type variables cannot be eta-reduced (see the canEtaReduce function for the criteria it would have to meet).
The data type has a DatatypeContext which mentions one of the eta-reduced type variables.
The data type has an existential constraint which mentions one of the eta-reduced type variables.
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.
A mapping of type variable Names to their auxiliary function Names.
Constructors
OneName :: Name -> OneOrTwoNames OneTwoNames :: Name -> Name -> OneOrTwoNames Two
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 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 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.
Returns True if a Type has kind *.
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.
If a Type is a SigT, returns its kind signature. Otherwise, return *.
Returns the number of fields for the constructor.
Returns True if it's a datatype with exactly one, non-existential constructor.
Returns True if it's a datatype with one or more nullary, non-GADT constructors.
Returns False if we're dealing with existential quantification or GADTs.
Generate a list of fresh names with a common prefix, and numbered suffixes.
Extracts the kind from a TyVarBndr.
Convert a TyVarBndr to a Type.
Applies a typeclass constraint to a type.
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:
All of the dropped types are type variables
All of the dropped types are distinct
None of the remaining types mention any of the dropped types
Extract the Name from a type constructor. If the argument Type is not a type variable, throw an error.
Extract Just the Name from a type variable. If the argument Type is not a type variable, return Nothing.
Extract the Name from a type variable. If the argument Type is not a type variable, throw an error.
Peel off a kind signature from a Type (if it has one).
Is the given type a variable?
Detect if a Name in a list of provided Names occurs as an argument to some type family. This makes an effort to exclude oversaturated arguments to type families. For instance, if one declared the following type family:
type family F a :: Type -> Type
Then in the type F a b, we would consider a to be an argument to F,
but not b.
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.
Does the given type mention any of the Names in the list?
Construct a type via curried application.
Fully applies a type constructor to its type variables.
Split an applied type into its individual components. For example, this:
Either Int Char
would split to this:
[Either, Int, Char]
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, ()])
Like uncurryType, except on a kind level.
Checks if a Name represents a tuple type constructor (other than ())
Checks if a String represents a tuple (other than ())
Checks if a String names a valid Haskell infix data constructor (i.e., does it begin with a colon?).