ghc-lib-0.20221201: The GHC API, decoupled from GHC versions
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.StgToJS.CoreUtils

Description

Core utils

Synopsis

Documentation

isUnboxableCon :: DataCon -> Bool Source #

can we unbox C x to x, only if x is represented as a Number

isUnboxable :: VarType -> Bool Source #

one-constructor types with one primitive field represented as a JS Number can be unboxed

data SlotCount Source #

Number of slots occupied by a PrimRep

Constructors

NoSlot 
OneSlot 
TwoSlots 

Instances

Instances details
Show SlotCount Source # 
Instance details

Defined in GHC.StgToJS.CoreUtils

Outputable SlotCount Source # 
Instance details

Defined in GHC.StgToJS.CoreUtils

Methods

ppr :: SlotCount -> SDoc #

Eq SlotCount Source # 
Instance details

Defined in GHC.StgToJS.CoreUtils

Ord SlotCount Source # 
Instance details

Defined in GHC.StgToJS.CoreUtils

slotCount :: SlotCount -> Int Source #

Return SlotCount as an Int

varSize :: VarType -> Int Source #

Number of slots occupied by a value with the given VarType

isMatchable :: [VarType] -> Bool Source #

can we pattern match on these values in a case?

tyConPrimRep' :: HasDebugCallStack => TyCon -> [PrimRep] Source #

Find the primitive representation of a TyCon. Defined here to avoid module loops. Call this only on unlifted tycons.

kindPrimRep' :: HasDebugCallStack => SDoc -> Kind -> [PrimRep] Source #

Take a kind (of shape TYPE rr) and produce the PrimReps of values of types of this kind.

assocPrimReps :: Outputable a => [PrimRep] -> [a] -> [(PrimRep, [a])] Source #

Associate the given values to each RrimRep in the given order, taking into account the number of slots per PrimRep

assocIdPrimReps :: Outputable a => Id -> [a] -> [(PrimRep, [a])] Source #

Associate the given values to the Id's PrimReps, taking into account the number of slots per PrimRep

assocIdExprs :: Id -> [JExpr] -> [TypedExpr] Source #

Associate the given JExpr to the Id's PrimReps, taking into account the number of slots per PrimRep

might_be_a_function :: HasDebugCallStack => Type -> Bool Source #

Return False only if we are *sure* it's a data type Look through newtypes etc as much as possible