This repository was archived by the owner on Jan 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
FP Use Cases
Aldwin Vlasblom edited this page Oct 28, 2021
·
12 revisions
Each row in the table below represents a “developer need“ which has been expressed through one or more issues in this repository. For each need, we record precedents addressing this need, and the way that the Function Helpers proposals currently addresses the need. Having the needs listed here is just a way to organize information for the facilitation of clear and informed communication.
The addition of a “need“ to the table does not necessarily mean that addressing it (better or more directly) is within the scope of this proposal. If a need has currently been deemed out of scope of the proposal, we will use strike through to indicate it.
Developer Need | Proposed Solution | Precedents |
---|---|---|
To apply a series of unary functions to a value in left-to-right order |
Function.pipe(value, ...fns) |
|
To apply a series of unary async functions to a value in left-to-right order |
Function.pipeAsync(value, ...fns) |
|
To define a function in terms of a series of function calls in left-to-right order |
Function.flow(...fns) |
|
To define a function in terms of a series of function calls in right-to-left order |
Function.flow(...fns.reverse()) |
|
To define a function in terms of a series of async function calls in left-to-right order |
Function.flowAsync(...fns) |
|
To define a function in terms of a series of async function calls in right-to-left order |
Function.flowAsync(...fns.reverse()) |
|
|
f => g => x => f(g(x)) |
|
To create a function that always returns the same value |
Function.constant(value) |
|
A function that returns its input unchanged to be used as an argument to HOFs |
Function.identity |
|
A way to run side effects inside a functional pipeline |
Function.aside(sideEffect) |