ghc-typelits-presburger-0.6.0.0: Presburger Arithmetic Solver for GHC Type-level natural numbers.
Safe HaskellNone
LanguageHaskell2010

GHC.TypeLits.Presburger.Compat

Synopsis

Documentation

data Plugin #

Plugin is the compiler plugin data type. Try to avoid constructing one of these directly, and just modify some fields of defaultPlugin instead: this is to try and preserve source-code compatibility when we add fields to this.

Nonetheless, this API is preliminary and highly likely to change in the future.

Constructors

Plugin 

Fields

tcInferApps #

Arguments

:: TcTyMode 
-> LHsType GhcRn

Function (for printing only)

-> TcType

Function

-> [LHsTypeArg GhcRn]

Args

-> TcM (TcType, TcKind)

(f args, args, result kind)

Apply a type of a given kind to a list of arguments. This instantiates invisible parameters as necessary. Always consumes all the arguments, using matchExpectedFunKind as necessary. This takes an optional VarEnv Kind which maps kind variables to kinds.- These kinds should be used to instantiate invisible kind variables; they come from an enclosing class for an associated type/data family.

tcInferApps also arranges to saturate any trailing invisible arguments of a type-family application, which is usually the right thing to do tcInferApps_nosat does not do this saturation; it is used only by ":kind" in GHCi

newWanted :: CtLoc -> PredType -> TcPluginM CtEvidence #

Create a new wanted constraint.

tcPluginTrace :: String -> SDoc -> TcPluginM () #

Output useful for debugging the compiler.

tcPluginIO :: IO a -> TcPluginM a #

Perform some IO, typically to interact with an external tool.

defaultPlugin :: Plugin #

Default plugin: does nothing at all, except for marking that safe inference has failed unless -fplugin-trustworthy is passed. For compatibility reaso you should base all your plugin definitions on this default value.

data TcPluginM a #

Instances

Instances details
Monad TcPluginM 
Instance details

Defined in TcRnTypes

Methods

(>>=) :: TcPluginM a -> (a -> TcPluginM b) -> TcPluginM b #

(>>) :: TcPluginM a -> TcPluginM b -> TcPluginM b #

return :: a -> TcPluginM a #

Functor TcPluginM 
Instance details

Defined in TcRnTypes

Methods

fmap :: (a -> b) -> TcPluginM a -> TcPluginM b #

(<$) :: a -> TcPluginM b -> TcPluginM a #

MonadFail TcPluginM 
Instance details

Defined in TcRnTypes

Methods

fail :: String -> TcPluginM a #

Applicative TcPluginM 
Instance details

Defined in TcRnTypes

Methods

pure :: a -> TcPluginM a #

(<*>) :: TcPluginM (a -> b) -> TcPluginM a -> TcPluginM b #

liftA2 :: (a -> b -> c) -> TcPluginM a -> TcPluginM b -> TcPluginM c #

(*>) :: TcPluginM a -> TcPluginM b -> TcPluginM b #

(<*) :: TcPluginM a -> TcPluginM b -> TcPluginM a #

data TcPlugin #

Constructors

TcPlugin 

Fields

data TcPluginResult #

Constructors

TcPluginContradiction [Ct]

The plugin found a contradiction. The returned constraints are removed from the inert set, and recorded as insoluble.

TcPluginOk [(EvTerm, Ct)] [Ct]

The first field is for constraints that were solved. These are removed from the inert set, and the evidence for them is recorded. The second field contains new work, that should be processed by the constraint solver.

data Ct #

Instances

Instances details
Outputable Ct 
Instance details

Defined in Constraint

Methods

ppr :: Ct -> SDoc #

pprPrec :: Rational -> Ct -> SDoc #

data HscEnv #

HscEnv is like Session, except that some of the fields are immutable. An HscEnv is used to compile a single module from plain Haskell source code (after preprocessing) to either C, assembly or C--. It's also used to store the dynamic linker state to allow for multiple linkers in the same address space. Things like the module graph don't change during a single compilation.

Historical note: "hsc" used to be the name of the compiler binary, when there was a separate driver and compiler. To compile a single module, the driver would invoke hsc on the source code... so nowadays we think of hsc as the layer of the compiler that deals with compiling a single module.

data EvTerm #

Instances

Instances details
Data EvTerm 
Instance details

Defined in TcEvidence

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> EvTerm -> c EvTerm #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c EvTerm #

toConstr :: EvTerm -> Constr #

dataTypeOf :: EvTerm -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c EvTerm) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EvTerm) #

gmapT :: (forall b. Data b => b -> b) -> EvTerm -> EvTerm #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EvTerm -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EvTerm -> r #

gmapQ :: (forall d. Data d => d -> u) -> EvTerm -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> EvTerm -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> EvTerm -> m EvTerm #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> EvTerm -> m EvTerm #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> EvTerm -> m EvTerm #

Outputable EvTerm 
Instance details

Defined in TcEvidence

Methods

ppr :: EvTerm -> SDoc #

pprPrec :: Rational -> EvTerm -> SDoc #

tcTyFamInsts :: Type -> [(TyCon, [Type])] #

Finds outermost type-family applications occurring in a type, after expanding synonyms. In the list (F, tys) that is returned we guarantee that tys matches F's arity. For example, given type family F a :: * -> * (arity 1) calling tcTyFamInsts on (Maybe (F Int Bool) will return (F, [Int]), not (F, [Int,Bool])

This is important for its use in deciding termination of type instances (see #11581). E.g. type instance G [Int] = ...(F Int type)... we don't need to take type into account when asking if the calls on the RHS are smaller than the LHS

data Pred #

A predicate in the solver. The solver tries to prove Wanted predicates from Given ones.

data EqRel #

A choice of equality relation. This is separate from the type Role because Phantom does not define a (non-trivial) equality relation.

Constructors

NomEq 
ReprEq 

Instances

Instances details
Eq EqRel 
Instance details

Defined in Predicate

Methods

(==) :: EqRel -> EqRel -> Bool #

(/=) :: EqRel -> EqRel -> Bool #

Ord EqRel 
Instance details

Defined in Predicate

Methods

compare :: EqRel -> EqRel -> Ordering #

(<) :: EqRel -> EqRel -> Bool #

(<=) :: EqRel -> EqRel -> Bool #

(>) :: EqRel -> EqRel -> Bool #

(>=) :: EqRel -> EqRel -> Bool #

max :: EqRel -> EqRel -> EqRel #

min :: EqRel -> EqRel -> EqRel #

Outputable EqRel 
Instance details

Defined in Predicate

Methods

ppr :: EqRel -> SDoc #

pprPrec :: Rational -> EqRel -> SDoc #

mkPrimEqPredRole :: Role -> Type -> Type -> PredType #

Makes a lifted equality predicate at the given role

splitTyConApp :: Type -> (TyCon, [Type]) #

Attempts to tease a type apart into a type constructor and the application of a number of arguments to that constructor. Panics if that is not possible. See also splitTyConApp_maybe

tyConAppTyCon_maybe :: Type -> Maybe TyCon #

The same as fst . splitTyConApp

data TCvSubst #

Type & coercion substitution

The following invariants must hold of a TCvSubst:

  1. The in-scope set is needed only to guide the generation of fresh uniques
  2. In particular, the kind of the type variables in the in-scope set is not relevant
  3. The substitution is only applied ONCE! This is because in general such application will not reach a fixed point.

Instances

Instances details
Outputable TCvSubst 
Instance details

Defined in TyCoSubst

type TvSubstEnv = TyVarEnv Type #

A substitution of Types for TyVars and Kinds for KindVars

mkTyConTy :: TyCon -> Type #

Create the plain type constructor type which has been applied to no type arguments at all.

eqType :: Type -> Type -> Bool #

Type equality on source types. Does not look through newtypes or PredTypes, but it does look through type synonyms. This first checks that the kinds of the types are equal and then checks whether the types are equal, ignoring casts and coercions. (The kind check is a recursive call, but since all kinds have type Type, there is no need to check the types of kinds.) See also Note [Non-trivial definitional equality] in TyCoRep.

splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type]) #

Attempts to tease a type apart into a type constructor and the application of a number of arguments to that constructor

tyConSkolem :: TyCon -> Bool #

Returns whether or not this TyCon is definite, or a hole that may be filled in at some later point. See Note [Skolem abstract data]

setRecTcMaxBound :: Int -> RecTcChecker -> RecTcChecker #

Change the upper bound for the number of times a RecTcChecker is allowed to encounter each TyCon.

defaultRecTcMaxBound :: Int #

The default upper bound (100) for the number of times a RecTcChecker is allowed to encounter each TyCon.

tcFlavourIsOpen :: TyConFlavour -> Bool #

Is this flavour of TyCon an open type family or a data family?

tyConRuntimeRepInfo :: TyCon -> RuntimeRepInfo #

Extract any RuntimeRepInfo from this TyCon

tyConFamilyCoercion_maybe :: TyCon -> Maybe (CoAxiom Unbranched) #

If this TyCon is that of a data family instance, return a TyCon which represents a coercion identifying the representation type with the type instance family. Otherwise, return Nothing

tyConFamInst_maybe :: TyCon -> Maybe (TyCon, [Type]) #

If this TyCon is that of a data family instance, return the family in question and the instance types. Otherwise, return Nothing

isFamInstTyCon :: TyCon -> Bool #

Is this TyCon that for a data family instance?

tyConATs :: TyCon -> [TyCon] #

Return the associated types of the TyCon, if any

tyConClass_maybe :: TyCon -> Maybe Class #

If this TyCon is that for a class instance, return the class it is for. Otherwise returns Nothing

isClassTyCon :: TyCon -> Bool #

Is this TyCon that for a class instance?

famTyConFlav_maybe :: TyCon -> Maybe FamTyConFlav #

Extract the flavour of a type family (with all the extra information that it carries)

synTyConRhs_maybe :: TyCon -> Maybe Type #

Extract the information pertaining to the right hand side of a type synonym (type) declaration.

synTyConDefn_maybe :: TyCon -> Maybe ([TyVar], Type) #

Extract the TyVars bound by a vanilla type synonym and the corresponding (unsubstituted) right hand side.

tyConStupidTheta :: TyCon -> [PredType] #

Find the "stupid theta" of the TyCon. A "stupid theta" is the context to the left of an algebraic type declaration, e.g. Eq a in the declaration data Eq a => T a ...

newTyConCo_maybe :: TyCon -> Maybe (CoAxiom Unbranched) #

Extracts the newtype coercion from such a TyCon, which can be used to construct something with the newtypes type from its representation type (right hand side). If the supplied TyCon is not a newtype, returns Nothing

newTyConEtadRhs :: TyCon -> ([TyVar], Type) #

Extract the bound type variables and type expansion of an eta-contracted type synonym TyCon. Panics if the TyCon is not a synonym

newTyConEtadArity :: TyCon -> Int #

The number of type parameters that need to be passed to a newtype to resolve it. May be less than in the definition if it can be eta-contracted.

newTyConRhs :: TyCon -> ([TyVar], Type) #

Extract the bound type variables and type expansion of a type synonym TyCon. Panics if the TyCon is not a synonym

tyConRoles :: TyCon -> [Role] #

Get the list of roles for the type parameters of a TyCon

tyConFamilyResVar_maybe :: TyCon -> Maybe Name #

Extract type variable naming the result of injective type family

algTyConRhs :: TyCon -> AlgTyConRhs #

Extract an AlgTyConRhs with information about data constructors from an algebraic or tuple TyCon. Panics for any other sort of TyCon

tyConFamilySize :: TyCon -> Int #

Determine the number of value constructors a TyCon has. Panics if the TyCon is not algebraic or a tuple

tyConSingleDataCon_maybe :: TyCon -> Maybe DataCon #

If the given TyCon has a single data constructor, i.e. it is a data type with one alternative, a tuple type or a newtype then that constructor is returned. If the TyCon has more than one constructor, or represents a primitive or function type constructor then Nothing is returned. In any other case, the function panics

tyConDataCons_maybe :: TyCon -> Maybe [DataCon] #

Determine the DataCons originating from the given TyCon, if the TyCon is the sort that can have any constructors (note: this does not include abstract algebraic types)

tyConDataCons :: TyCon -> [DataCon] #

As tyConDataCons_maybe, but returns the empty list of constructors if no constructors could be found

isTyConWithSrcDataCons :: TyCon -> Bool #

Check if the tycon actually refers to a proper `data` or `newtype` with user defined constructors rather than one from a class or other construction.

expandSynTyCon_maybe #

Arguments

:: TyCon 
-> [tyco]

Arguments to TyCon

-> Maybe ([(TyVar, tyco)], Type, [tyco])

Returns a TyVar substitution, the body type of the synonym (not yet substituted) and any arguments remaining from the application

Expand a type synonym application, if any

isTcLevPoly :: TyCon -> Bool #

Could this TyCon ever be levity-polymorphic when fully applied? True is safe. False means we're sure. Does only a quick check based on the TyCon's category. Precondition: The fully-applied TyCon has kind (TYPE blah)

isTcTyCon :: TyCon -> Bool #

Is this a TcTyCon? (That is, one only used during type-checking?)

isImplicitTyCon :: TyCon -> Bool #

Identifies implicit tycons that, in particular, do not go into interface files (because they are implicitly reconstructed when the interface is read).

Note that:

  • Associated families are implicit, as they are re-constructed from the class declaration in which they reside, and
  • Family instances are not implicit as they represent the instance body (similar to a dfun does that for a class instance).
  • Tuples are implicit iff they have a wired-in name (namely: boxed and unboxed tuples are wired-in and implicit, but constraint tuples are not)

isKindTyCon :: TyCon -> Bool #

Is this tycon really meant for use at the kind level? That is, should it be permitted without -XDataKinds?

isPromotedDataCon_maybe :: TyCon -> Maybe DataCon #

Retrieves the promoted DataCon if this is a PromotedDataCon;

isPromotedDataCon :: TyCon -> Bool #

Is this a PromotedDataCon?

isPromotedTupleTyCon :: TyCon -> Bool #

Is this the TyCon for a promoted tuple?

isUnboxedSumTyCon :: TyCon -> Bool #

Is this the TyCon for an unboxed sum?

isBoxedTupleTyCon :: TyCon -> Bool #

Is this the TyCon for a boxed tuple?

tyConFlavourAssoc_maybe :: TyConFlavour -> Maybe TyCon #

Get the enclosing class TyCon (if there is one) for the given TyConFlavour

tyConAssoc_maybe :: TyCon -> Maybe TyCon #

Get the enclosing class TyCon (if there is one) for the given TyCon.

isTyConAssoc :: TyCon -> Bool #

Is this TyCon for an associated type?

tyConInjectivityInfo :: TyCon -> Injectivity #

tyConInjectivityInfo tc returns Injective is is tc is an injective tycon (where is states for which tyConBinders tc is injective), or NotInjective otherwise.

isClosedSynFamilyTyConWithAxiom_maybe :: TyCon -> Maybe (CoAxiom Branched) #

Is this a non-empty closed type family? Returns Nothing for abstract or empty closed families.

isOpenTypeFamilyTyCon :: TyCon -> Bool #

Is this an open type family TyCon?

isDataFamilyTyCon :: TyCon -> Bool #

Is this a synonym TyCon that can have may have further instances appear?

isTypeFamilyTyCon :: TyCon -> Bool #

Is this a synonym TyCon that can have may have further instances appear?

isOpenFamilyTyCon :: TyCon -> Bool #

Is this a TyCon, synonym or otherwise, that defines a family with instances?

isFamilyTyCon :: TyCon -> Bool #

Is this a TyCon, synonym or otherwise, that defines a family?

isEnumerationTyCon :: TyCon -> Bool #

Is this an algebraic TyCon which is just an enumeration of values?

isGadtSyntaxTyCon :: TyCon -> Bool #

Is this an algebraic TyCon declared with the GADT syntax?

mustBeSaturated :: TyCon -> Bool #

True iff we can decompose (T a b c) into ((T a b) c) I.e. is it injective and generative w.r.t nominal equality? That is, if (T a b) ~N d e f, is it always the case that (T ~N d), (a ~N e) and (b ~N f)? Specifically NOT true of synonyms (open and otherwise)

It'd be unusual to call mustBeSaturated on a regular H98 type synonym, because you should probably have expanded it first But regardless, it's not decomposable

isTypeSynonymTyCon :: TyCon -> Bool #

Is this a TyCon representing a regular H98 type synonym (type)?

unwrapNewTyCon_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched) #

Take a TyCon apart into the TyVars it scopes over, the Type it expands into, and (possibly) a coercion from the representation type to the newtype. Returns Nothing if this is not possible.

isNewTyCon :: TyCon -> Bool #

Is this TyCon that for a newtype

isGenInjAlgRhs :: AlgTyConRhs -> Bool #

Is this an AlgTyConRhs of a TyCon that is generative and injective with respect to representational equality?

isGenerativeTyCon :: TyCon -> Role -> Bool #

isGenerativeTyCon is true of TyCons for which this property holds (where X is the role passed in): If (T tys ~X t), then (t's head ~X T). See also Note [Decomposing equality] in TcCanonical

isInjectiveTyCon :: TyCon -> Role -> Bool #

isInjectiveTyCon is true of TyCons for which this property holds (where X is the role passed in): If (T a1 b1 c1) ~X (T a2 b2 c2), then (a1 ~X1 a2), (b1 ~X2 b2), and (c1 ~X3 c2) (where X1, X2, and X3, are the roles given by tyConRolesX tc X) See also Note [Decomposing equality] in TcCanonical

isDataTyCon :: TyCon -> Bool #

Returns True for data types that are definitely represented by heap-allocated constructors. These are scrutinised by Core-level case expressions, and they get info tables allocated for them.

Generally, the function will be true for all data types and false for newtypes, unboxed tuples, unboxed sums and type family TyCons. But it is not guaranteed to return True in all cases that it could.

NB: for a data type family, only the instance TyCons get an info table. The family declaration TyCon does not

isVanillaAlgTyCon :: TyCon -> Bool #

Returns True for vanilla AlgTyCons -- that is, those created with a data or newtype declaration.

isAlgTyCon :: TyCon -> Bool #

Returns True if the supplied TyCon resulted from either a data or newtype declaration

isUnliftedTyCon :: TyCon -> Bool #

Is this TyCon unlifted (i.e. cannot contain bottom)? Note that this can only be true for primitive and unboxed-tuple TyCons

isPrimTyCon :: TyCon -> Bool #

Does this TyCon represent something that cannot be defined in Haskell?

isAbstractTyCon :: TyCon -> Bool #

Test if the TyCon is algebraic but abstract (invisible data constructors)

mkPromotedDataCon :: DataCon -> Name -> TyConRepName -> [TyConTyCoBinder] -> Kind -> [Role] -> RuntimeRepInfo -> TyCon #

Create a promoted data constructor TyCon Somewhat dodgily, we give it the same Name as the data constructor itself; when we pretty-print the TyCon we add a quote; see the Outputable TyCon instance

mkFamilyTyCon #

Arguments

:: Name 
-> [TyConBinder] 
-> Kind

result kind

-> Maybe Name 
-> FamTyConFlav 
-> Maybe Class 
-> Injectivity 
-> TyCon 

Create a type family TyCon

mkSynonymTyCon #

Arguments

:: Name 
-> [TyConBinder] 
-> Kind

result kind

-> [Role] 
-> Type 
-> Bool 
-> Bool 
-> TyCon 

Create a type synonym TyCon

mkLiftedPrimTyCon #

Arguments

:: Name 
-> [TyConBinder] 
-> Kind

result kind

-> [Role] 
-> TyCon 

Create a lifted primitive TyCon such as RealWorld

mkKindTyCon #

Arguments

:: Name 
-> [TyConBinder] 
-> Kind

result kind

-> [Role] 
-> Name 
-> TyCon 

Kind constructors

mkPrimTyCon #

Arguments

:: Name 
-> [TyConBinder] 
-> Kind

result kind, never levity-polymorphic

-> [Role] 
-> TyCon 

Create an unlifted primitive TyCon, such as Int#.

noTcTyConScopedTyVars :: [(Name, TcTyVar)] #

No scoped type variables (to be used with mkTcTyCon).

mkTcTyCon #

Arguments

:: Name 
-> [TyConBinder] 
-> Kind

result kind only

-> [(Name, TcTyVar)]

Scoped type variables; see Note [How TcTyCons work] in TcTyClsDecls

-> Bool

Is this TcTyCon generalised already?

-> TyConFlavour

What sort of TyCon this represents

-> TyCon 

Makes a tycon suitable for use during type-checking. It stores a variety of details about the definition of the TyCon, but no right-hand side. It lives only during the type-checking of a mutually-recursive group of tycons; it is then zonked to a proper TyCon in zonkTcTyCon. See also Note [Kind checking recursive type and class declarations] in TcTyClsDecls.

mkSumTyCon #

Arguments

:: Name 
-> [TyConBinder] 
-> Kind

Kind of the resulting TyCon

-> Arity

Arity of the sum

-> [TyVar]

TyVars scoped over: see tyConTyVars

-> [DataCon] 
-> AlgTyConFlav 
-> TyCon 

mkTupleTyCon #

Arguments

:: Name 
-> [TyConBinder] 
-> Kind

Result kind of the TyCon

-> Arity

Arity of the tuple TyCon

-> DataCon 
-> TupleSort

Whether the tuple is boxed or unboxed

-> AlgTyConFlav 
-> TyCon 

mkClassTyCon :: Name -> [TyConBinder] -> [Role] -> AlgTyConRhs -> Class -> Name -> TyCon #

Simpler specialization of mkAlgTyCon for classes

mkAlgTyCon #

Arguments

:: Name 
-> [TyConBinder]

Binders of the TyCon

-> Kind

Result kind

-> [Role]

The roles for each TyVar

-> Maybe CType

The C type this type corresponds to when using the CAPI FFI

-> [PredType]

Stupid theta: see algTcStupidTheta

-> AlgTyConRhs

Information about data constructors

-> AlgTyConFlav

What flavour is it? (e.g. vanilla, type family)

-> Bool

Was the TyCon declared with GADT syntax?

-> TyCon 

This is the making of an algebraic TyCon. Notably, you have to pass in the generic (in the -XGenerics sense) information about the type constructor - you can get hold of it easily (see Generics module)

mkFunTyCon :: Name -> [TyConBinder] -> Name -> TyCon #

Given the name of the function type constructor and it's kind, create the corresponding TyCon. It is recommended to use funTyCon if you want this functionality

lookupTyConFieldLabel :: FieldLabelString -> TyCon -> Maybe FieldLabel #

Look up a field label belonging to this TyCon

tyConFieldLabels :: TyCon -> [FieldLabel] #

The labels for the fields of this particular TyCon

primRepIsFloat :: PrimRep -> Maybe Bool #

Return if Rep stands for floating type, returns Nothing for vector types.

primRepSizeB :: DynFlags -> PrimRep -> Int #

The size of a PrimRep in bytes.

This applies also when used in a constructor, where we allow packing the fields. For instance, in data Foo = Foo Float the two fields will take only 8 bytes, which for 64-bit arch will be equal to 1 word. See also mkVirtHeapOffsetsWithPadding for details of how data fields are layed out.

tyConRepModOcc :: Module -> OccName -> (Module, OccName) #

The name (and defining module) for the Typeable representation (TyCon) of a type constructor.

See Note [Grand plan for Typeable] in TcTypeable in TcTypeable.

mkPrelTyConRepName :: Name -> TyConRepName #

Make a Name for the Typeable representation of the given wired-in type

visibleDataCons :: AlgTyConRhs -> [DataCon] #

Both type classes as well as family instances imply implicit type constructors. These implicit type constructors refer to their parent structure (ie, the class or family from which they derive) using a type of the following form.

Extract those DataCons that we are able to learn about. Note that visibility in this sense does not correspond to visibility in the context of any particular user program!

mkRequiredTyConBinder :: TyCoVarSet -> TyVar -> TyConBinder #

Make a Required TyConBinder. It chooses between NamedTCB and AnonTCB based on whether the tv is mentioned in the dependent set

data TyConBndrVis #

Instances

Instances details
Binary TyConBndrVis 
Instance details

Defined in TyCon

Outputable TyConBndrVis 
Instance details

Defined in TyCon

OutputableBndr tv => Outputable (VarBndr tv TyConBndrVis) 
Instance details

Defined in TyCon

data AlgTyConRhs #

Represents right-hand-sides of TyCons for algebraic types

Constructors

AbstractTyCon

Says that we know nothing about this data type, except that it's represented by a pointer. Used when we export a data type abstractly into an .hi file.

DataTyCon

Information about those TyCons derived from a data declaration. This includes data types with no constructors at all.

Fields

  • data_cons :: [DataCon]

    The data type constructors; can be empty if the user declares the type to have no constructors

    INVARIANT: Kept in order of increasing DataCon tag (see the tag assignment in mkTyConTagMap)

  • data_cons_size :: Int

    Cached value: length data_cons

  • is_enum :: Bool

    Cached value: is this an enumeration type? See Note [Enumeration types]

TupleTyCon 

Fields

SumTyCon

An unboxed sum type.

Fields

  • data_cons :: [DataCon]

    The data type constructors; can be empty if the user declares the type to have no constructors

    INVARIANT: Kept in order of increasing DataCon tag (see the tag assignment in mkTyConTagMap)

  • data_cons_size :: Int

    Cached value: length data_cons

NewTyCon

Information about those TyCons derived from a newtype declaration

Fields

data RuntimeRepInfo #

Some promoted datacons signify extra info relevant to GHC. For example, the IntRep constructor of RuntimeRep corresponds to the IntRep constructor of PrimRep. This data structure allows us to store this information right in the TyCon. The other approach would be to look up things like RuntimeRep's PrimRep by known-key every time. See also Note [Getting from RuntimeRep to PrimRep] in RepType

Constructors

NoRRI

an ordinary promoted data con

RuntimeRep ([Type] -> [PrimRep])

A constructor of RuntimeRep. The argument to the function should be the list of arguments to the promoted datacon.

VecCount Int

A constructor of VecCount

VecElem PrimElemRep

A constructor of VecElem

data AlgTyConFlav #

Constructors

VanillaAlgTyCon TyConRepName

An ordinary type constructor has no parent.

UnboxedAlgTyCon (Maybe TyConRepName)

An unboxed type constructor. The TyConRepName is a Maybe since we currently don't allow unboxed sums to be Typeable since there are too many of them. See #13276.

ClassTyCon Class TyConRepName

Type constructors representing a class dictionary. See Note [ATyCon for classes] in TyCoRep

DataFamInstTyCon (CoAxiom Unbranched) TyCon [Type]

Type constructors representing an *instance* of a *data* family. Parameters:

1) The type family in question

2) Instance types; free variables are the tyConTyVars of the current TyCon (not the family one). INVARIANT: the number of types matches the arity of the family TyCon

3) A CoTyCon identifying the representation type with the type instance family

Instances

Instances details
Outputable AlgTyConFlav 
Instance details

Defined in TyCon

data Injectivity #

Constructors

NotInjective 
Injective [Bool] 

Instances

Instances details
Eq Injectivity 
Instance details

Defined in TyCon

Binary Injectivity 
Instance details

Defined in TyCon

data FamTyConFlav #

Information pertaining to the expansion of a type synonym (type)

Constructors

DataFamilyTyCon TyConRepName

Represents an open type family without a fixed right hand side. Additional instances can appear at any time.

These are introduced by either a top level declaration:

data family T a :: *

Or an associated data type declaration, within a class declaration:

class C a b where
  data T b :: *
OpenSynFamilyTyCon

An open type synonym family e.g. type family F x y :: * -> *

ClosedSynFamilyTyCon (Maybe (CoAxiom Branched))

A closed type synonym family e.g. type family F x where { F Int = Bool }

AbstractClosedSynFamilyTyCon

A closed type synonym family declared in an hs-boot file with type family F a where ..

BuiltInSynFamTyCon BuiltInSynFamily

Built-in type family used by the TypeNats solver

Instances

Instances details
Outputable FamTyConFlav 
Instance details

Defined in TyCon

data PrimRep #

A PrimRep is an abstraction of a type. It contains information that the code generator needs in order to pass arguments, return results, and store values of this type. See also Note [RuntimeRep and PrimRep] in RepType and Note [VoidRep] in RepType.

Constructors

VoidRep 
LiftedRep 
UnliftedRep

Unlifted pointer

Int8Rep

Signed, 8-bit value

Int16Rep

Signed, 16-bit value

Int32Rep

Signed, 32-bit value

Int64Rep

Signed, 64 bit value (with 32-bit words only)

IntRep

Signed, word-sized value

Word8Rep

Unsigned, 8 bit value

Word16Rep

Unsigned, 16 bit value

Word32Rep

Unsigned, 32 bit value

Word64Rep

Unsigned, 64 bit value (with 32-bit words only)

WordRep

Unsigned, word-sized value

AddrRep

A pointer, but not to a Haskell value (use '(Un)liftedRep')

FloatRep 
DoubleRep 
VecRep Int PrimElemRep

A vector

Instances

Instances details
Show PrimRep 
Instance details

Defined in TyCon

Outputable PrimRep 
Instance details

Defined in TyCon

Methods

ppr :: PrimRep -> SDoc #

pprPrec :: Rational -> PrimRep -> SDoc #

data PrimElemRep #

Instances

Instances details
Eq PrimElemRep 
Instance details

Defined in TyCon

Show PrimElemRep 
Instance details

Defined in TyCon

Outputable PrimElemRep 
Instance details

Defined in TyCon

data TyConFlavour #

Paints a picture of what a TyCon represents, in broad strokes. This is used towards more informative error messages.

Instances

Instances details
Eq TyConFlavour 
Instance details

Defined in TyCon

Outputable TyConFlavour 
Instance details

Defined in TyCon

data Role #

Instances

Instances details
Eq Role 
Instance details

Defined in CoAxiom

Methods

(==) :: Role -> Role -> Bool #

(/=) :: Role -> Role -> Bool #

Data Role 
Instance details

Defined in CoAxiom

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Role -> c Role #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Role #

toConstr :: Role -> Constr #

dataTypeOf :: Role -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Role) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Role) #

gmapT :: (forall b. Data b => b -> b) -> Role -> Role #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Role -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Role -> r #

gmapQ :: (forall d. Data d => d -> u) -> Role -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Role -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Role -> m Role #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Role -> m Role #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Role -> m Role #

Ord Role 
Instance details

Defined in CoAxiom

Methods

compare :: Role -> Role -> Ordering #

(<) :: Role -> Role -> Bool #

(<=) :: Role -> Role -> Bool #

(>) :: Role -> Role -> Bool #

(>=) :: Role -> Role -> Bool #

max :: Role -> Role -> Role #

min :: Role -> Role -> Role #

Binary Role 
Instance details

Defined in CoAxiom

Methods

put_ :: BinHandle -> Role -> IO () #

put :: BinHandle -> Role -> IO (Bin Role) #

get :: BinHandle -> IO Role #

Outputable Role 
Instance details

Defined in CoAxiom

Methods

ppr :: Role -> SDoc #

pprPrec :: Rational -> Role -> SDoc #

data BuiltInSynFamily #

Constructors

BuiltInSynFamily 

Fields

type TyVar = Var #

Type or kind Variable

lookupPackageName :: DynFlags -> PackageName -> Maybe ComponentId #

Find the package we know about with the given package name (e.g. foo), if any (NB: there might be a locally defined unit name which overrides this)

data Type #

Constructors

TyVarTy Var

Vanilla type or kind variable (*never* a coercion variable)

AppTy Type Type

Type application to something other than a TyCon. Parameters:

1) Function: must not be a TyConApp or CastTy, must be another AppTy, or TyVarTy See Note Respecting definitional equality about the no CastTy requirement

2) Argument type

TyConApp TyCon [KindOrType]

Application of a TyCon, including newtypes and synonyms. Invariant: saturated applications of FunTyCon must use FunTy and saturated synonyms must use their own constructors. However, unsaturated FunTyCons do appear as TyConApps. Parameters:

1) Type constructor being applied to.

2) Type arguments. Might not have enough type arguments here to saturate the constructor. Even type synonyms are not necessarily saturated; for example unsaturated type synonyms can appear as the right hand side of a type synonym.

ForAllTy !TyCoVarBinder Type

A Π type.

FunTy

t1 -> t2 Very common, so an important special case See Note [Function types]

Fields

LitTy TyLit

Type literals are similar to type constructors.

CastTy Type KindCoercion

A kind cast. The coercion is always nominal. INVARIANT: The cast is never refl. INVARIANT: The Type is not a CastTy (use TransCo instead) See Note Respecting definitional equality and (EQ3)

CoercionTy Coercion

Injection of a Coercion into a type This should only ever be used in the RHS of an AppTy, in the list of a TyConApp, when applying a promoted GADT data constructor

Instances

Instances details
Data Type 
Instance details

Defined in TyCoRep

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Type -> c Type #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Type #

toConstr :: Type -> Constr #

dataTypeOf :: Type -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Type) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type) #

gmapT :: (forall b. Data b => b -> b) -> Type -> Type #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r #

gmapQ :: (forall d. Data d => d -> u) -> Type -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Type -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Type -> m Type #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type #

Outputable Type 
Instance details

Defined in TyCoRep

Methods

ppr :: Type -> SDoc #

pprPrec :: Rational -> Type -> SDoc #

data TyLit #

Constructors

NumTyLit Integer 

Instances

Instances details
Eq TyLit 
Instance details

Defined in TyCoRep

Methods

(==) :: TyLit -> TyLit -> Bool #

(/=) :: TyLit -> TyLit -> Bool #

Data TyLit 
Instance details

Defined in TyCoRep

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TyLit -> c TyLit #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TyLit #

toConstr :: TyLit -> Constr #

dataTypeOf :: TyLit -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TyLit) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TyLit) #

gmapT :: (forall b. Data b => b -> b) -> TyLit -> TyLit #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TyLit -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TyLit -> r #

gmapQ :: (forall d. Data d => d -> u) -> TyLit -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TyLit -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TyLit -> m TyLit #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TyLit -> m TyLit #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TyLit -> m TyLit #

Ord TyLit 
Instance details

Defined in TyCoRep

Methods

compare :: TyLit -> TyLit -> Ordering #

(<) :: TyLit -> TyLit -> Bool #

(<=) :: TyLit -> TyLit -> Bool #

(>) :: TyLit -> TyLit -> Bool #

(>=) :: TyLit -> TyLit -> Bool #

max :: TyLit -> TyLit -> TyLit #

min :: TyLit -> TyLit -> TyLit #

Outputable TyLit 
Instance details

Defined in TyCoRep

Methods

ppr :: TyLit -> SDoc #

pprPrec :: Rational -> TyLit -> SDoc #

mkInstTyTcOcc #

Arguments

:: String

Family name, e.g. Map

-> OccSet

avoid these Occs

-> OccName
R:Map

Derive a name for the representation type constructor of a data/newtype instance.

fsToUnitId :: FastString -> UnitId #

Create a new simple unit identifier from a FastString. Internally, this is primarily used to specify wired-in unit identifiers.

ppr :: Outputable a => a -> SDoc #

data ModuleName #

A ModuleName is essentially a simple string, e.g. Data.List.

Instances

Instances details
Eq ModuleName 
Instance details

Defined in Module

Data ModuleName 
Instance details

Defined in Module

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ModuleName -> c ModuleName #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ModuleName #

toConstr :: ModuleName -> Constr #

dataTypeOf :: ModuleName -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ModuleName) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ModuleName) #

gmapT :: (forall b. Data b => b -> b) -> ModuleName -> ModuleName #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ModuleName -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ModuleName -> r #

gmapQ :: (forall d. Data d => d -> u) -> ModuleName -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ModuleName -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ModuleName -> m ModuleName #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ModuleName -> m ModuleName #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ModuleName -> m ModuleName #

Ord ModuleName 
Instance details

Defined in Module

NFData ModuleName 
Instance details

Defined in Module

Methods

rnf :: ModuleName -> () #

Binary ModuleName 
Instance details

Defined in Module

Uniquable ModuleName 
Instance details

Defined in Module

Outputable ModuleName 
Instance details

Defined in Module

BinaryStringRep ModuleName 
Instance details

Defined in Module

DbUnitIdModuleRep InstalledUnitId ComponentId UnitId ModuleName Module 
Instance details

Defined in Module

unpackFS :: FastString -> String #

Unpacks and decodes the FastString

data FastString #

A FastString is a UTF-8 encoded string together with a unique ID. All FastStrings are stored in a global hashtable to support fast O(1) comparison.

It is also associated with a lazy reference to the Z-encoding of this string which is used by the compiler internally.

Instances

Instances details
Eq FastString 
Instance details

Defined in FastString

Data FastString 
Instance details

Defined in FastString

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FastString -> c FastString #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FastString #

toConstr :: FastString -> Constr #

dataTypeOf :: FastString -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c FastString) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FastString) #

gmapT :: (forall b. Data b => b -> b) -> FastString -> FastString #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FastString -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FastString -> r #

gmapQ :: (forall d. Data d => d -> u) -> FastString -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> FastString -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> FastString -> m FastString #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FastString -> m FastString #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FastString -> m FastString #

Ord FastString 
Instance details

Defined in FastString

Show FastString 
Instance details

Defined in FastString

IsString FastString 
Instance details

Defined in FastString

Semigroup FastString 
Instance details

Defined in FastString

Monoid FastString 
Instance details

Defined in FastString

NFData FastString 
Instance details

Defined in FastString

Methods

rnf :: FastString -> () #

Uniquable FastString 
Instance details

Defined in Unique

Outputable FastString 
Instance details

Defined in Outputable

isTupleTyCon :: TyCon -> Bool #

Does this TyCon represent a tuple?

NB: when compiling Data.Tuple, the tycons won't reply True to isTupleTyCon, because they are built as AlgTyCons. However they get spat into the interface file as tuple tycons, so I don't think it matters.

isUnboxedTupleTyCon :: TyCon -> Bool #

Is this the TyCon for an unboxed tuple?

data TyCon #

TyCons represent type constructors. Type constructors are introduced by things such as:

1) Data declarations: data Foo = ... creates the Foo type constructor of kind *

2) Type synonyms: type Foo = ... creates the Foo type constructor

3) Newtypes: newtype Foo a = MkFoo ... creates the Foo type constructor of kind * -> *

4) Class declarations: class Foo where creates the Foo type constructor of kind *

This data type also encodes a number of primitive, built in type constructors such as those for function and tuple types.

Instances

Instances details
Eq TyCon 
Instance details

Defined in TyCon

Methods

(==) :: TyCon -> TyCon -> Bool #

(/=) :: TyCon -> TyCon -> Bool #

Data TyCon 
Instance details

Defined in TyCon

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TyCon -> c TyCon #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TyCon #

toConstr :: TyCon -> Constr #

dataTypeOf :: TyCon -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TyCon) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TyCon) #

gmapT :: (forall b. Data b => b -> b) -> TyCon -> TyCon #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TyCon -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TyCon -> r #

gmapQ :: (forall d. Data d => d -> u) -> TyCon -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TyCon -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TyCon -> m TyCon #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TyCon -> m TyCon #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TyCon -> m TyCon #

NamedThing TyCon 
Instance details

Defined in TyCon

Uniquable TyCon 
Instance details

Defined in TyCon

Methods

getUnique :: TyCon -> Unique #

Outputable TyCon 
Instance details

Defined in TyCon

Methods

ppr :: TyCon -> SDoc #

pprPrec :: Rational -> TyCon -> SDoc #

tracePlugin :: String -> TcPlugin -> TcPlugin #

Print out extra information about the initialisation, stop, and every run of the plugin when -ddump-tc-trace is enabled.

lookupName :: Module -> OccName -> TcPluginM Name #

Find a Name in a Module given an OccName

lookupModule #

Arguments

:: ModuleName

Name of the module

-> FastString

Name of the package containing the module. NOTE: This value is ignored on ghc>=8.0.

-> TcPluginM Module 

Find a module

evByFiat #

Arguments

:: String

Name the coercion should have

-> Type

The LHS of the equivalence relation (~)

-> Type

The RHS of the equivalence relation (~)

-> EvTerm 

The EvTerm equivalent for unsafeCoerce

newtype TypeEq Source #

Constructors

TypeEq 

Fields

Instances

Instances details
Eq TypeEq Source # 
Instance details

Defined in GHC.TypeLits.Presburger.Compat

Methods

(==) :: TypeEq -> TypeEq -> Bool #

(/=) :: TypeEq -> TypeEq -> Bool #

Ord TypeEq Source # 
Instance details

Defined in GHC.TypeLits.Presburger.Compat

data TvSubst Source #

Instances

Instances details
Outputable TvSubst Source # 
Instance details

Defined in GHC.TypeLits.Presburger.Compat

Methods

ppr :: TvSubst -> SDoc #

pprPrec :: Rational -> TvSubst -> SDoc #