const -package:base

const x y always evaluates to x, ignoring its second argument.
>>> const 42 "hello"
42
>>> map (const 42) [0..3]
[42,42,42,42]
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]
const x is a unary function which evaluates to x for all inputs.
>>> const 42 "hello"
42
>>> map (const 42) [0..3]
[42,42,42,42]
const x is a unary function which evaluates to x for all inputs. For instance,
>>> map (const 42) [0..3]
[42,42,42,42]
Make a scan that yields the supplied value on any input. Pre-release
const x is a unary function which evaluates to x for all inputs.
>>> const 42 "hello"
42
>>> map (const 42) [0..3]
[42,42,42,42]
Convert between () and a constant (not a true bijection).
Lifts the input value as a constant into an expression.
Adds an element to the head of an n-ary tuple
>>> consT 5 (True,'c')
(5,True,'c')
Not on Stackage, so not searched. Read-only mutable primitives
Differentiable logging constant function.

Examples of usage

>>> import Control.Arrow (runKleisli)

>>> import Control.Monad.Logger (runStdoutLoggingT)

>>> import Debug.SimpleExpr.Expr (variable)

>>> import InfBackprop (call, derivative)
>>> runStdoutLoggingT $ runKleisli (call (const 42)) ()
42
Infinitely differentiable constant function.

Examples of usage

>>> import Prelude (Float)

>>> import InfBackprop (call, derivative, derivativeN)
>>> call (const 5) ()
5
>>> derivative (const (5 :: Float)) 42
0
>>> derivativeN 2 (const (5 :: Float)) 42
0.0
The Const functor.
The Const functor.
Constants for a pure type system The axioms are:
⊦ Type : Kind
⊦ Kind : Sort
... and the valid rule pairs are:
⊦ Type ↝ Type : Type  -- Functions from terms to terms (ordinary functions)
⊦ Kind ↝ Type : Type  -- Functions from types to terms (type-polymorphic functions)
⊦ Sort ↝ Type : Type  -- Functions from kinds to terms
⊦ Kind ↝ Kind : Kind  -- Functions from types to types (type-level functions)
⊦ Sort ↝ Kind : Sort  -- Functions from kinds to types (kind-polymorphic functions)
⊦ Sort ↝ Sort : Sort  -- Functions from kinds to kinds (kind-level functions)
Note that Dhall does not support functions from terms to types and therefore Dhall is not a dependently typed language
Const c                                  ~  c