Package: effect
Module: Function
Reverses the order of arguments for a curried function.
When to use
Use to adapt a curried function when its argument groups need to be supplied in the opposite order.
Example (Flipping curried arguments)
import { Function } from "effect"
import * as assert from "node:assert"
const f = (a: number) => (b: string) => a - b.length
assert.deepStrictEqual(Function.flip(f)("aaa")(2), -1)
Signature
declare const flip: <A extends Array<unknown>, B extends Array<unknown>, C>(f: (...a: A) => (...b: B) => C) => (...b: B) => (...a: A) => C
Since v2.0.0