cons package:base

Synonym for <|.
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]
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
Semantically, considerAccessible = True. But it has special meaning to the pattern-match checker, which will never flag the clause in which considerAccessible occurs as a guard as redundant or inaccessible. Example:
case (x, x) of
(True,  True)  -> 1
(False, False) -> 2
(True,  False) -> 3 -- Warning: redundant
The pattern-match checker will warn here that the third clause is redundant. It will stop doing so if the clause is adorned with considerAccessible:
case (x, x) of
(True,  True)  -> 1
(False, False) -> 2
(True,  False) | considerAccessible -> 3 -- No warning
Put considerAccessible as the last statement of the guard to avoid get confusing results from the pattern-match checker, which takes "consider accessible" by word.
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]
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.
NB. the contents of this module are only available on Windows. Installing Win32 console handlers.
Class for datatypes that represent data constructors
Extending a type-level symbol with a type-level character
Decompose a list into its head and tail.
  • If the list is empty, returns Nothing.
  • If the list is non-empty, returns Just (x, xs), where x is the head of the list and xs its tail.

Examples

>>> uncons []
Nothing
>>> uncons [1]
Just (1,[])
>>> uncons [1, 2, 3]
Just (1,[2,3])