packages feed

ddc-code-0.4.2.1: tetra/base/Data/Function.ds

module  Data.Function
export  { id; apply; compose }
where


-- | Identity function.
id (x: a): a
 = x


-- | Apply a function to its argument.
--   The operator '$' is desugared to applications of this function.
apply   [a b: Data]   (f: a -> b) (x: a): b
 = f x


-- | Compose two functions.
--   The operator '∘' is desugared to applications of this function.
compose [a b c: Data] (f: b -> c) (g: a -> b): a -> c
 = λx : a. f (g x)