So-called Literals are one of:
An unboxed numeric literal or floating-point literal which is presumed to be surrounded by appropriate constructors (
Int#, etc.), so that the overall thing makes sense.
We maintain the invariant that the Integer in the LitNumber constructor is actually in the (possibly target-dependent) range. The mkLit{Int,Word}*Wrap smart constructors ensure this by applying the target machine's wrapping semantics. Use these in situations where you know the wrapping semantics are correct.
The literal derived from the label mentioned in a "foreign label" declaration (LitLabel)
A LitRubbish to be used in place of values that are never used.
A character
A string
The NULL pointer
Constructors
LitChar CharChar#- at least 31 bits. Create with mkLitCharLitNumber !LitNumType !IntegerAny numeric literal that can be internally represented with an Integer.
LitString !ByteStringA string-literal: stored and emitted UTF-8 encoded, we'll arrange to decode it at runtime. Also emitted with a
'\0'terminator. Create with mkLitStringLitNullAddrThe
NULLpointer, the only pointer value that can be represented as a Literal. Create with nullAddrLitLitRubbish TypeOrConstraint RuntimeRepTypeA nonsense value; See Note [Rubbish literals].
LitFloat RationalFloat#. Create with mkLitFloatLitDouble RationalDouble#. Create with mkLitDoubleLitLabel FastString (Maybe Int) FunctionOrDataA label literal. Parameters:
1) The name of the symbol mentioned in the declaration
2) The size (in bytes) of the arguments the label expects. Only applicable with
stdcalllabels.Just x=><x>will be appended to label name when emitting assembly.3) Flag indicating whether the symbol references a function or a data
Instances5Eq, Data, Ord, Outputable, Binary
Eq LiteralDefined in ghc-9.10.3 · GHC.Types.LiteralData LiteralDefined in ghc-9.10.3 · GHC.Types.LiteralOrd LiteralDefined in ghc-9.10.3 · GHC.Types.LiteralNeeded for the
Ordinstance ofAltCon, which in turn is needed inGHC.Data.TrieMap.CoreMap.Outputable LiteralDefined in ghc-9.10.3 · GHC.Types.LiteralBinary LiteralDefined in ghc-9.10.3 · GHC.Types.Literal