const package:base

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
Representation of constructors. Note that equality on constructors with different types may not work -- i.e. the constructors for False and Nothing may compare equal.
Public representation of constructors
The kind of lifted constraints
This module provides typed const pointers to foreign data. It is part of the Foreign Function Interface (FFI).
A pointer with the C const qualifier. For instance, an argument of type ConstPtr CInt would be marshalled as const int*. While const-ness generally does not matter for ccall imports (since const and non-const pointers typically have equivalent calling conventions), it does matter for capi imports. See GHC #22043.
Class for datatypes that represent data constructors
Gets the constructors of an algebraic datatype