gleam/function

Functions

pub fn apply1(fun: fn(a) -> b, arg1: a) -> b

Deprecated: Use a fn literal instead, it is easier to understand

pub fn apply2(fun: fn(a, b) -> c, arg1: a, arg2: b) -> c

Deprecated: Use a fn literal instead, it is easier to understand

pub fn apply3(
  fun: fn(a, b, c) -> d,
  arg1: a,
  arg2: b,
  arg3: c,
) -> d

Deprecated: Use a fn literal instead, it is easier to understand

pub fn compose(fun1: fn(a) -> b, fun2: fn(b) -> c) -> fn(a) -> c

Deprecated: Use a fn literal instead, it is easier to understand

pub fn constant(value: a) -> fn(b) -> a

Deprecated: Use a fn literal instead, it is easier to understand

pub fn curry2(fun: fn(a, b) -> c) -> fn(a) -> fn(b) -> c

Deprecated: Use the anonymous function syntax instead

pub fn curry3(
  fun: fn(a, b, c) -> d,
) -> fn(a) -> fn(b) -> fn(c) -> d

Deprecated: Use the anonymous function syntax instead

pub fn curry4(
  fun: fn(a, b, c, d) -> e,
) -> fn(a) -> fn(b) -> fn(c) -> fn(d) -> e

Deprecated: Use the anonymous function syntax instead

pub fn curry5(
  fun: fn(a, b, c, d, e) -> f,
) -> fn(a) -> fn(b) -> fn(c) -> fn(d) -> fn(e) -> f

Deprecated: Use the anonymous function syntax instead

pub fn curry6(
  fun: fn(a, b, c, d, e, f) -> g,
) -> fn(a) -> fn(b) -> fn(c) -> fn(d) -> fn(e) -> fn(f) -> g

Deprecated: Use the anonymous function syntax instead

pub fn flip(fun: fn(a, b) -> c) -> fn(b, a) -> c

Takes a function that takes two arguments and returns a new function that takes the same two arguments, but in reverse order.

pub fn identity(x: a) -> a

Takes a single argument and always returns its input value.

pub fn tap(arg: a, effect: fn(a) -> b) -> a

Takes an argument and a single function, calls that function with that argument and returns that argument instead of the function return value. Useful for running synchronous side effects in a pipeline.

Search Document