const package:ghc-internal

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]
The Const functor.

Examples

>>> fmap (++ "World") (Const "Hello")
Const "Hello"
Because we ignore the second type parameter to Const, the Applicative instance, which has (<*>) :: Monoid m => Const m (a -> b) -> Const m a -> Const m b essentially turns into Monoid m => m -> m -> m, which is (<>)
>>> Const [1, 2, 3] <*> Const [4, 5, 6]
Const [1,2,3,4,5,6]
Gets the field labels of a constructor. The list of labels is returned in the same order as they were given in the original constructor declaration.
Gets the fixity of a constructor
Gets the index of a constructor (algebraic datatypes only)
Gets the public presentation of constructors
Gets the datatype of a constructor
The kind of lifted constraints