const is:exact

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 y always evaluates to x, ignoring its second argument.
>>> 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]
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')
Construct a stream that has the same given value at each step.
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