Skip to content

uncurry

uncurry<C>(f): () => C

Defined in: Composition/uncurry.ts:29

Converts a curried function into a multi-argument function. Useful when you want to call a curried function with all arguments at once.

Handles functions with 0, 1, or 2 curried arguments.

C

() => () => C

(): C

C

// Thunks: () => () => C becomes () => C
const nested = () => () => 42;
uncurry(nested)(); // 42

// Original curried function
Option.map(n => n * 2)(Option.of(5)); // Some(10)

// Uncurried - all arguments at once
const mapUncurried = uncurry(Option.map);
mapUncurried(n => n * 2, Option.of(5)); // Some(10)

// Combined with flip for data-first uncurried
const mapDataFirst = uncurry(flip(Option.map));
mapDataFirst(Option.of(5), n => n * 2); // Some(10)
  • flip for reversing curried argument order
  • uncurry3 for 3-argument curried functions
  • uncurry4 for 4-argument curried functions

uncurry<A, C>(f): (a) => C

Defined in: Composition/uncurry.ts:30

Converts a curried function into a multi-argument function. Useful when you want to call a curried function with all arguments at once.

Handles functions with 0, 1, or 2 curried arguments.

A

C

(a) => () => C

(a): C

A

C

// Thunks: () => () => C becomes () => C
const nested = () => () => 42;
uncurry(nested)(); // 42

// Original curried function
Option.map(n => n * 2)(Option.of(5)); // Some(10)

// Uncurried - all arguments at once
const mapUncurried = uncurry(Option.map);
mapUncurried(n => n * 2, Option.of(5)); // Some(10)

// Combined with flip for data-first uncurried
const mapDataFirst = uncurry(flip(Option.map));
mapDataFirst(Option.of(5), n => n * 2); // Some(10)
  • flip for reversing curried argument order
  • uncurry3 for 3-argument curried functions
  • uncurry4 for 4-argument curried functions

uncurry<A, B, C>(f): (a, b) => C

Defined in: Composition/uncurry.ts:31

Converts a curried function into a multi-argument function. Useful when you want to call a curried function with all arguments at once.

Handles functions with 0, 1, or 2 curried arguments.

A

B

C

(a) => (b) => C

(a, b): C

A

B

C

// Thunks: () => () => C becomes () => C
const nested = () => () => 42;
uncurry(nested)(); // 42

// Original curried function
Option.map(n => n * 2)(Option.of(5)); // Some(10)

// Uncurried - all arguments at once
const mapUncurried = uncurry(Option.map);
mapUncurried(n => n * 2, Option.of(5)); // Some(10)

// Combined with flip for data-first uncurried
const mapDataFirst = uncurry(flip(Option.map));
mapDataFirst(Option.of(5), n => n * 2); // Some(10)
  • flip for reversing curried argument order
  • uncurry3 for 3-argument curried functions
  • uncurry4 for 4-argument curried functions