Module

Neon.Primitive.Function

Package
purescript-neon
Repository
tfausak/purescript-neon

#always Source

always :: forall b a. a -> b -> a

Always returns the first argument.

"anything" :always 1 -- 1

This is the constant function.

#compose Source

compose :: forall c b a. (b -> c) -> (a -> b) -> (a -> c)

Returns a new function that calls the first function with the result of calling the second.

let addTwo x = x + 2
let double x = x * 2
let addTwoThenDouble x = addTwo :compose double
addTwoThenDouble 3 -- 10

This is function composition.

#flip Source

flip :: forall c b a. (a -> b -> c) -> (b -> a -> c)

Flips the first two arguments of a function.

"a" :add "b" -- "ab"
"a" :flip add "b" -- "ba"

#identity Source

identity :: forall a. a -> a

Returns the value it was given.

identity 1 -- 1

This is the identity function.