Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data DataCon
- data DataConRep
- = NoDataConRep
- | DCR {
- dcr_wrap_id :: Id
- dcr_boxer :: DataConBoxer
- dcr_arg_tys :: [Scaled Type]
- dcr_stricts :: [StrictnessMark]
- dcr_bangs :: [HsImplBang]
- data SrcStrictness
- data SrcUnpackedness
- data HsSrcBang = HsSrcBang SourceText SrcUnpackedness SrcStrictness
- data HsImplBang
- data StrictnessMark
- type ConTag = Int
- type DataConEnv a = UniqFM DataCon a
- data EqSpec
- mkEqSpec :: TyVar -> Type -> EqSpec
- eqSpecTyVar :: EqSpec -> TyVar
- eqSpecType :: EqSpec -> Type
- eqSpecPair :: EqSpec -> (TyVar, Type)
- eqSpecPreds :: [EqSpec] -> ThetaType
- data FieldLabel = FieldLabel {}
- data FieldLabelString
- mkDataCon :: Name -> Bool -> TyConRepName -> [HsSrcBang] -> [FieldLabel] -> [TyVar] -> [TyCoVar] -> [InvisTVBinder] -> [EqSpec] -> KnotTied ThetaType -> [KnotTied (Scaled Type)] -> KnotTied Type -> PromDataConInfo -> KnotTied TyCon -> ConTag -> ThetaType -> Id -> DataConRep -> DataCon
- fIRST_TAG :: ConTag
- dataConRepType :: DataCon -> Type
- dataConInstSig :: DataCon -> [Type] -> ([TyCoVar], ThetaType, [Type])
- dataConFullSig :: DataCon -> ([TyVar], [TyCoVar], [EqSpec], ThetaType, [Scaled Type], Type)
- dataConName :: DataCon -> Name
- dataConIdentity :: DataCon -> ByteString
- dataConTag :: DataCon -> ConTag
- dataConTagZ :: DataCon -> ConTagZ
- dataConTyCon :: DataCon -> TyCon
- dataConOrigTyCon :: DataCon -> TyCon
- dataConWrapperType :: DataCon -> Type
- dataConNonlinearType :: DataCon -> Type
- dataConDisplayType :: Bool -> DataCon -> Type
- dataConUnivTyVars :: DataCon -> [TyVar]
- dataConExTyCoVars :: DataCon -> [TyCoVar]
- dataConUnivAndExTyCoVars :: DataCon -> [TyCoVar]
- dataConUserTyVars :: DataCon -> [TyVar]
- dataConUserTyVarBinders :: DataCon -> [InvisTVBinder]
- dataConTheta :: DataCon -> ThetaType
- dataConStupidTheta :: DataCon -> ThetaType
- dataConOtherTheta :: DataCon -> ThetaType
- dataConInstArgTys :: DataCon -> [Type] -> [Scaled Type]
- dataConOrigArgTys :: DataCon -> [Scaled Type]
- dataConOrigResTy :: DataCon -> Type
- dataConInstOrigArgTys :: DataCon -> [Type] -> [Scaled Type]
- dataConRepArgTys :: DataCon -> [Scaled Type]
- dataConResRepTyArgs :: DataCon -> [Type]
- dataConInstUnivs :: DataCon -> [Type] -> [Type]
- dataConFieldLabels :: DataCon -> [FieldLabel]
- dataConFieldType :: DataCon -> FieldLabelString -> Type
- dataConFieldType_maybe :: DataCon -> FieldLabelString -> Maybe (FieldLabel, Type)
- dataConSrcBangs :: DataCon -> [HsSrcBang]
- dataConSourceArity :: DataCon -> Arity
- dataConRepArity :: DataCon -> Arity
- dataConIsInfix :: DataCon -> Bool
- dataConWorkId :: DataCon -> Id
- dataConWrapId :: DataCon -> Id
- dataConWrapId_maybe :: DataCon -> Maybe Id
- dataConImplicitTyThings :: DataCon -> [TyThing]
- dataConRepStrictness :: DataCon -> [StrictnessMark]
- dataConImplBangs :: DataCon -> [HsImplBang]
- dataConBoxer :: DataCon -> Maybe DataConBoxer
- splitDataProductType_maybe :: Type -> Maybe (TyCon, [Type], DataCon, [Scaled Type])
- isNullarySrcDataCon :: DataCon -> Bool
- isNullaryRepDataCon :: DataCon -> Bool
- isTupleDataCon :: DataCon -> Bool
- isBoxedTupleDataCon :: DataCon -> Bool
- isUnboxedTupleDataCon :: DataCon -> Bool
- isUnboxedSumDataCon :: DataCon -> Bool
- isCovertGadtDataCon :: DataCon -> Bool
- isVanillaDataCon :: DataCon -> Bool
- isNewDataCon :: DataCon -> Bool
- isTypeDataCon :: DataCon -> Bool
- classDataCon :: Class -> DataCon
- dataConCannotMatch :: [Type] -> DataCon -> Bool
- dataConUserTyVarsNeedWrapper :: DataCon -> Bool
- checkDataConTyVars :: DataCon -> Bool
- isBanged :: HsImplBang -> Bool
- isMarkedStrict :: StrictnessMark -> Bool
- cbvFromStrictMark :: StrictnessMark -> CbvMark
- eqHsBang :: HsImplBang -> HsImplBang -> Bool
- isSrcStrict :: SrcStrictness -> Bool
- isSrcUnpacked :: SrcUnpackedness -> Bool
- specialPromotedDc :: DataCon -> Bool
- promoteDataCon :: DataCon -> TyCon
Main data types
A data constructor
Instances
Data DataCon Source # | |
Defined in GHC.Core.DataCon gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DataCon -> c DataCon Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DataCon Source # toConstr :: DataCon -> Constr Source # dataTypeOf :: DataCon -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DataCon) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DataCon) Source # gmapT :: (forall b. Data b => b -> b) -> DataCon -> DataCon Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DataCon -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DataCon -> r Source # gmapQ :: (forall d. Data d => d -> u) -> DataCon -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> DataCon -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> DataCon -> m DataCon Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DataCon -> m DataCon Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DataCon -> m DataCon Source # | |
NamedThing DataCon Source # | |
Uniquable DataCon Source # | |
Outputable DataCon Source # | |
OutputableBndr DataCon Source # | |
Defined in GHC.Core.DataCon | |
Eq DataCon Source # | |
data DataConRep Source #
Data Constructor Representation See Note [Data constructor workers and wrappers]
NoDataConRep | |
DCR | |
|
data SrcStrictness Source #
Source Strictness
What strictness annotation the user wrote
SrcLazy | Lazy, ie |
SrcStrict | Strict, ie |
NoSrcStrict | no strictness annotation |
Instances
data SrcUnpackedness Source #
Source Unpackedness
What unpackedness the user requested
SrcUnpack | {-# UNPACK #-} specified |
SrcNoUnpack | {-# NOUNPACK #-} specified |
NoSrcUnpack | no unpack pragma |
Instances
Haskell Source Bang
Bangs on data constructor arguments as the user wrote them in the source code.
(HsSrcBang _ SrcUnpack SrcLazy)
and
(HsSrcBang _ SrcUnpack NoSrcStrict)
(without StrictData) makes no sense, we
emit a warning (in checkValidDataCon) and treat it like
(HsSrcBang _ NoSrcUnpack SrcLazy)
Instances
Data HsSrcBang Source # | |
Defined in GHC.Core.DataCon gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsSrcBang -> c HsSrcBang Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c HsSrcBang Source # toConstr :: HsSrcBang -> Constr Source # dataTypeOf :: HsSrcBang -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c HsSrcBang) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsSrcBang) Source # gmapT :: (forall b. Data b => b -> b) -> HsSrcBang -> HsSrcBang Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsSrcBang -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsSrcBang -> r Source # gmapQ :: (forall d. Data d => d -> u) -> HsSrcBang -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> HsSrcBang -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsSrcBang -> m HsSrcBang Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsSrcBang -> m HsSrcBang Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsSrcBang -> m HsSrcBang Source # | |
Outputable HsSrcBang Source # | |
data HsImplBang Source #
Haskell Implementation Bang
Bangs of data constructor arguments as generated by the compiler after consulting HsSrcBang, flags, etc.
HsLazy | Lazy field, or one with an unlifted type |
HsStrict Bool | Strict but not unpacked field True = we could have unpacked, but opted not to because of -O0. See Note [Detecting useless UNPACK pragmas] |
HsUnpack (Maybe Coercion) | Strict and unpacked field co :: arg-ty ~ product-ty HsBang |
Instances
Data HsImplBang Source # | |
Defined in GHC.Core.DataCon gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsImplBang -> c HsImplBang Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c HsImplBang Source # toConstr :: HsImplBang -> Constr Source # dataTypeOf :: HsImplBang -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c HsImplBang) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsImplBang) Source # gmapT :: (forall b. Data b => b -> b) -> HsImplBang -> HsImplBang Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsImplBang -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsImplBang -> r Source # gmapQ :: (forall d. Data d => d -> u) -> HsImplBang -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> HsImplBang -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsImplBang -> m HsImplBang Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsImplBang -> m HsImplBang Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsImplBang -> m HsImplBang Source # | |
Outputable HsImplBang Source # | |
Defined in GHC.Core.DataCon ppr :: HsImplBang -> SDoc Source # |
data StrictnessMark Source #
Instances
Binary StrictnessMark Source # | |
Defined in GHC.Core.DataCon put_ :: BinHandle -> StrictnessMark -> IO () Source # put :: BinHandle -> StrictnessMark -> IO (Bin StrictnessMark) Source # | |
Outputable StrictnessMark Source # | |
Defined in GHC.Core.DataCon ppr :: StrictnessMark -> SDoc Source # | |
Eq StrictnessMark Source # | |
Defined in GHC.Core.DataCon (==) :: StrictnessMark -> StrictnessMark -> Bool # (/=) :: StrictnessMark -> StrictnessMark -> Bool # |
A *one-index* constructor tag
Type of the tags associated with each constructor possibility or superclass selector
type DataConEnv a = UniqFM DataCon a Source #
Equality specs
An EqSpec
is a tyvar/type pair representing an equality made in
rejigging a GADT constructor
Instances
eqSpecTyVar :: EqSpec -> TyVar Source #
eqSpecType :: EqSpec -> Type Source #
eqSpecPreds :: [EqSpec] -> ThetaType Source #
Field labels
data FieldLabel Source #
Fields in an algebraic record type; see Note [FieldLabel].
FieldLabel | |
|
Instances
Data FieldLabel Source # | |
Defined in GHC.Types.FieldLabel gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FieldLabel -> c FieldLabel Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FieldLabel Source # toConstr :: FieldLabel -> Constr Source # dataTypeOf :: FieldLabel -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c FieldLabel) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FieldLabel) Source # gmapT :: (forall b. Data b => b -> b) -> FieldLabel -> FieldLabel Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FieldLabel -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FieldLabel -> r Source # gmapQ :: (forall d. Data d => d -> u) -> FieldLabel -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> FieldLabel -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> FieldLabel -> m FieldLabel Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FieldLabel -> m FieldLabel Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FieldLabel -> m FieldLabel Source # | |
NFData FieldLabel Source # | |
Defined in GHC.Types.FieldLabel rnf :: FieldLabel -> () Source # | |
HasOccName FieldLabel Source # | |
Defined in GHC.Types.FieldLabel occName :: FieldLabel -> OccName Source # | |
Binary Name => Binary FieldLabel Source # | We need the |
Defined in GHC.Types.FieldLabel put_ :: BinHandle -> FieldLabel -> IO () Source # put :: BinHandle -> FieldLabel -> IO (Bin FieldLabel) Source # | |
Outputable FieldLabel Source # | |
Defined in GHC.Types.FieldLabel ppr :: FieldLabel -> SDoc Source # | |
Eq FieldLabel Source # | |
Defined in GHC.Types.FieldLabel (==) :: FieldLabel -> FieldLabel -> Bool # (/=) :: FieldLabel -> FieldLabel -> Bool # |
data FieldLabelString Source #
Field labels are just represented as strings; they are not necessarily unique (even within a module)
Instances
Type construction
:: Name | |
-> Bool | Is the constructor declared infix? |
-> TyConRepName | TyConRepName for the promoted TyCon |
-> [HsSrcBang] | Strictness/unpack annotations, from user |
-> [FieldLabel] | Field labels for the constructor, if it is a record, otherwise empty |
-> [TyVar] | Universals. |
-> [TyCoVar] | Existentials. |
-> [InvisTVBinder] | User-written |
-> [EqSpec] | GADT equalities |
-> KnotTied ThetaType | Theta-type occurring before the arguments proper |
-> [KnotTied (Scaled Type)] | Original argument types |
-> KnotTied Type | Original result type |
-> PromDataConInfo | See comments on |
-> KnotTied TyCon | Representation type constructor |
-> ConTag | Constructor tag |
-> ThetaType | The "stupid theta", context of the data
declaration e.g. |
-> Id | Worker Id |
-> DataConRep | Representation |
-> DataCon |
Build a new data constructor
Tags are allocated from here for real constructors or for superclass selectors
Type deconstruction
dataConRepType :: DataCon -> Type Source #
The representation type of the data constructor, i.e. the sort type that will represent values of this type at runtime
dataConInstSig :: DataCon -> [Type] -> ([TyCoVar], ThetaType, [Type]) Source #
Instantiate the universal tyvars of a data con, returning ( instantiated existentials , instantiated constraints including dependent GADT equalities which are *also* listed in the instantiated existentials , instantiated args)
dataConFullSig :: DataCon -> ([TyVar], [TyCoVar], [EqSpec], ThetaType, [Scaled Type], Type) Source #
The "full signature" of the DataCon
returns, in order:
1) The result of dataConUnivTyVars
2) The result of dataConExTyCoVars
3) The non-dependent GADT equalities. Dependent GADT equalities are implied by coercion variables in return value (2).
4) The other constraints of the data constructor type, excluding GADT equalities
5) The original argument types to the DataCon
(i.e. before
any change of the representation of the type) with linearity
annotations
6) The original result type of the DataCon
dataConName :: DataCon -> Name Source #
dataConIdentity :: DataCon -> ByteString Source #
The string package:module.name
identifying a constructor, which is attached
to its info table and used by the GHCi debugger and the heap profiler
dataConTagZ :: DataCon -> ConTagZ Source #
dataConTyCon :: DataCon -> TyCon Source #
The type constructor that we are building via this data constructor
dataConOrigTyCon :: DataCon -> TyCon Source #
The original type constructor used in the definition of this data constructor. In case of a data family instance, that will be the family type constructor.
dataConWrapperType :: DataCon -> Type Source #
The user-declared type of the data constructor in the nice-to-read form:
T :: forall a b. a -> b -> T [a]
rather than:
T :: forall a c. forall b. (c~[a]) => a -> b -> T c
The type variables are quantified in the order that the user wrote them.
See Note [DataCon user type variable binders]
.
NB: If the constructor is part of a data instance, the result type mentions the family tycon, not the internal one.
dataConNonlinearType :: DataCon -> Type Source #
dataConUnivTyVars :: DataCon -> [TyVar] Source #
The universally-quantified type variables of the constructor
dataConExTyCoVars :: DataCon -> [TyCoVar] Source #
The existentially-quantified type/coercion variables of the constructor including dependent (kind-) GADT equalities
dataConUnivAndExTyCoVars :: DataCon -> [TyCoVar] Source #
Both the universal and existential type/coercion variables of the constructor
dataConUserTyVars :: DataCon -> [TyVar] Source #
The type variables of the constructor, in the order the user wrote them
dataConUserTyVarBinders :: DataCon -> [InvisTVBinder] Source #
InvisTVBinder
s for the type variables of the constructor, in the order the
user wrote them
dataConTheta :: DataCon -> ThetaType Source #
The *full* constraints on the constructor type, including dependent GADT equalities.
dataConStupidTheta :: DataCon -> ThetaType Source #
The "stupid theta" of the DataCon
, such as data Eq a
in:
data Eq a => T a = ...
See Note [The stupid context]
.
dataConOtherTheta :: DataCon -> ThetaType Source #
Returns constraints in the wrapper type, other than those in the dataConEqSpec
:: DataCon | A datacon with no existentials or equality constraints However, it can have a dcTheta (notably it can be a class dictionary, with superclasses) |
-> [Type] | Instantiated at these types |
-> [Scaled Type] |
Finds the instantiated types of the arguments required to construct a
DataCon
representation
NB: these INCLUDE any dictionary args
but EXCLUDE the data-declaration context, which is discarded
It's all post-flattening etc; this is a representation type
dataConOrigArgTys :: DataCon -> [Scaled Type] Source #
Returns the argument types of the wrapper, excluding all dictionary arguments and without substituting for any type variables
dataConOrigResTy :: DataCon -> Type Source #
dataConInstOrigArgTys :: DataCon -> [Type] -> [Scaled Type] Source #
Returns just the instantiated value argument types of a DataCon
,
(excluding dictionary args)
dataConRepArgTys :: DataCon -> [Scaled Type] Source #
Returns the arg types of the worker, including *all* non-dependent evidence, after any flattening has been done and without substituting for any type variables
dataConResRepTyArgs :: DataCon -> [Type] Source #
Were the type variables of the data con written in a different order than the regular order (universal tyvars followed by existential tyvars)?
This is not a cheap test, so we minimize its use in GHC as much as possible.
Currently, its only call site in the GHC codebase is in mkDataConRep
in
MkId, and so dataConUserTyVarsNeedWrapper
is only called at most once
during a data constructor's lifetime.
dataConInstUnivs :: DataCon -> [Type] -> [Type] Source #
Given a data constructor dc
with n universally quantified type
variables a_{1}
, a_{2}
, ..., a_{n}
, and given a list of argument
types dc_args
of length m where m <= n, then:
dataConInstUnivs dc dc_args
Will return:
[dc_arg_{1}, dc_arg_{2}, ..., dc_arg_{m}, a_{m+1}, ..., a_{n}]
That is, return the list of universal type variables with
a_{1}
, a_{2}
, ..., a_{m}
instantiated with
dc_arg_{1}
, dc_arg_{2}
, ..., dc_arg_{m}
. It is possible for m
to
be less than n
, in which case the remaining n - m
elements will simply
be universal type variables (with their kinds possibly instantiated).
Examples:
- Given the data constructor
D :: forall a b. Foo a b
anddc_args
[Int, Bool]
, thendataConInstUnivs D dc_args
will return[Int, Bool]
. - Given the data constructor
D :: forall a b. Foo a b
anddc_args
[Int]
, then @dataConInstUnivs D dc_args
will return[Int, b]
. - Given the data constructor
E :: forall k (a :: k). Bar k a
anddc_args
[Type]
, then @dataConInstUnivs D dc_args
will return[Type, (a :: Type)]
.
This is primarily used in GHC.Tc.Deriv.*
in service of instantiating data
constructors' field types.
See Note [Instantiating field types in stock deriving]
for a notable
example of this.
dataConFieldLabels :: DataCon -> [FieldLabel] Source #
The labels for the fields of this particular DataCon
dataConFieldType :: DataCon -> FieldLabelString -> Type Source #
Extract the type for any given labelled field of the DataCon
dataConFieldType_maybe :: DataCon -> FieldLabelString -> Maybe (FieldLabel, Type) Source #
dataConSrcBangs :: DataCon -> [HsSrcBang] Source #
Strictness/unpack annotations, from user; or, for imported
DataCons, from the interface file
The list is in one-to-one correspondence with the arity of the DataCon
dataConSourceArity :: DataCon -> Arity Source #
Source-level arity of the data constructor
dataConRepArity :: DataCon -> Arity Source #
Gives the number of actual fields in the representation of the data constructor. This may be more than appear in the source code; the extra ones are the existentially quantified dictionaries
dataConWorkId :: DataCon -> Id Source #
dataConWrapId :: DataCon -> Id Source #
Returns an Id which looks like the Haskell-source constructor by using
the wrapper if it exists (see dataConWrapId_maybe
) and failing over to
the worker (see dataConWorkId
)
dataConWrapId_maybe :: DataCon -> Maybe Id Source #
Get the Id of the DataCon
wrapper: a function that wraps the "actual"
constructor so it has the type visible in the source program: c.f.
dataConWorkId
.
Returns Nothing if there is no wrapper, which occurs for an algebraic data
constructor and also for a newtype (whose constructor is inlined
compulsorily)
dataConImplicitTyThings :: DataCon -> [TyThing] Source #
Find all the Id
s implicitly brought into scope by the data constructor. Currently,
the union of the dataConWorkId
and the dataConWrapId
dataConRepStrictness :: DataCon -> [StrictnessMark] Source #
Give the demands on the arguments of a Core constructor application (Con dc args)
dataConImplBangs :: DataCon -> [HsImplBang] Source #
dataConBoxer :: DataCon -> Maybe DataConBoxer Source #
splitDataProductType_maybe Source #
Extract the type constructor, type argument, data constructor and it's representation argument types from a type if it is a product type.
Precisely, we return Just
for any data type that is all of:
- Concrete (i.e. constructors visible)
- Single-constructor
- ... which has no existentials
Whether the type is a data
type or a newtype
.
Predicates on DataCons
isNullarySrcDataCon :: DataCon -> Bool Source #
Return whether there are any argument types for this DataCon
s original source type
See Note [DataCon arities]
isNullaryRepDataCon :: DataCon -> Bool Source #
Return whether there are any argument types for this DataCon
s runtime representation type
See Note [DataCon arities]
isTupleDataCon :: DataCon -> Bool Source #
isBoxedTupleDataCon :: DataCon -> Bool Source #
isUnboxedTupleDataCon :: DataCon -> Bool Source #
isUnboxedSumDataCon :: DataCon -> Bool Source #
isCovertGadtDataCon :: DataCon -> Bool Source #
isVanillaDataCon :: DataCon -> Bool Source #
Vanilla DataCon
s are those that are nice boring Haskell 98 constructors
isTypeDataCon :: DataCon -> Bool Source #
Is this data constructor in a "type data" declaration? See Note [Type data declarations] in GHC.Rename.Module.
classDataCon :: Class -> DataCon Source #
checkDataConTyVars :: DataCon -> Bool Source #
isBanged :: HsImplBang -> Bool Source #
isMarkedStrict :: StrictnessMark -> Bool Source #
eqHsBang :: HsImplBang -> HsImplBang -> Bool Source #
Compare strictness annotations
isSrcStrict :: SrcStrictness -> Bool Source #
isSrcUnpacked :: SrcUnpackedness -> Bool Source #
specialPromotedDc :: DataCon -> Bool Source #
Should this DataCon be allowed in a type even without -XDataKinds? Currently, only Lifted & Unlifted
Promotion related functions
promoteDataCon :: DataCon -> TyCon Source #
Orphan instances
Binary SrcStrictness Source # | |
put_ :: BinHandle -> SrcStrictness -> IO () Source # put :: BinHandle -> SrcStrictness -> IO (Bin SrcStrictness) Source # | |
Binary SrcUnpackedness Source # | |
put_ :: BinHandle -> SrcUnpackedness -> IO () Source # put :: BinHandle -> SrcUnpackedness -> IO (Bin SrcUnpackedness) Source # | |
Outputable SrcStrictness Source # | |
ppr :: SrcStrictness -> SDoc Source # | |
Outputable SrcUnpackedness Source # | |
ppr :: SrcUnpackedness -> SDoc Source # |