const x = \_ -> xThis function might seem useless at first glance, but it can be very useful in a higher order context.
>>> const 42 "hello" 42
>>> map (const 42) [0..3] [42,42,42,42]
>>> const 42 "hello" 42
>>> map (const 42) [0..3] [42,42,42,42]
>>> const 42 "hello" 42
>>> map (const 42) [0..3] [42,42,42,42]
>>> map (const 42) [0..3] [42,42,42,42]
>>> const 42 "hello" 42
>>> map (const 42) [0..3] [42,42,42,42]
>>> consT 5 (True,'c') (5,True,'c')
>>> import Control.Arrow (runKleisli) >>> import Control.Monad.Logger (runStdoutLoggingT) >>> import Debug.SimpleExpr.Expr (variable) >>> import InfBackprop (call, derivative)
>>> runStdoutLoggingT $ runKleisli (call (const 42)) () 42
>>> 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
>>> 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]
⊦ 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