const package:ghc-lib-parser

const x y always evaluates to x, ignoring its second argument.
const x = \_ -> x
This function might seem useless at first glance, but it can be very useful in a higher order context.

Examples

>>> const 42 "hello"
42
>>> map (const 42) [0..3]
[42,42,42,42]
This function obtain a diagnostic code by looking up the constructor name using generics, and using the GhcDiagnosticCode type family.
This function computes all diagnostic codes that occur inside a given type using generics and the GhcDiagnosticCode type family. For example, if T = MkT1 | MkT2, GhcDiagnosticCode "MkT1" = 123 and GhcDiagnosticCode "MkT2" = 456, then we will get > constructorCodes @T = fromList [ (123, "MkT1"), (456, "MkT2") ]
Constant Folder