Convert a literal from one index type to another. The constraint XXLit (GhcPass p)~DataConCantHappen means that once the XLit constructor is inhabited, we can no longer go back to the case where its not. In practice it just means you can't just convertLit to go from (HsLit GhcTc) -> (HsLit GhcPs/GhcRn), while all other conversions are fine.
Moduleghc-9.14.1GHC2021
GHC.Hs.Lit
Source-language literals
- 3 types
- 7 values
- Packageghc-9.14.1
- Exports10
- LanguageGHC2021
- LicenceBSD-3-Clause
- SourceLit.hs
module Language.Haskell.Syntax.Lit
hsLitNeedsParens p l returns True if a literal l needs
to be parenthesized under precedence p.
See Note [Printing of literals in Core] in GHC.Types.Literal for the reasoning.
hsOverLitNeedsParens p ol returns True if an overloaded literal
ol needs to be parenthesized under precedence p.
pmPprHsLit pretty prints literals and is used when pretty printing pattern match warnings. All are printed the same (i.e., without hashes if they are primitive and not wrapped in constructors if they are boxed). This happens mainly for too reasons: * We do not want to expose their internal representation * The warnings become too messy
Constructors
HsInteger SourceText Integer TypeGenuinely an integer; arises only from TRANSLATION (overloaded literals are done with HsOverLit)
HsRat FractionalLit TypeGenuinely a rational; arises only from TRANSLATION (overloaded literals are done with HsOverLit)
Constructors
Constructors
Orphan instances
5 instancesOutputable OverLitValEq (XXOverLit p) => Eq (HsOverLit p)Ord (XXOverLit p) => Ord (HsOverLit p)IsPass p => Outputable (HsLit (GhcPass p))OutputableBndrId p => Outputable (HsOverLit (GhcPass p))