/Prelude-v23.1.0/Function/compose.dhall

Copy path to clipboard

Compose two functions into one.

Examples

compose Natural Natural Bool (λ(n : Natural) → n + n) Natural/even 3 ≡ True

Source

--| Compose two functions into one.
let compose
: ∀(a : Type) → ∀(b : Type) → ∀(c : Type) → (a → b) → (b → c) → a → c
= λ(a : Type) →
λ(b : Type) →
λ(c : Type) →
λ(f : ab) →
λ(g : bc) →
λ(x : a) →
g (f x)

let example0 =
assert
: compose Natural Natural Bool (λ(n : Natural) → n + n) Natural/even 3
≡ True

in compose