-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Foldable / FlodableWithIndex: curry toReadonlyArrayWith and add toRea…
…donlyArray
- Loading branch information
1 parent
9683f82
commit ba899d7
Showing
6 changed files
with
87 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@fp-ts/core": patch | ||
--- | ||
|
||
Foldable / FlodableWithIndex: curry toReadonlyArrayWith and add toReadonlyArray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import * as _ from "@fp-ts/core/internal/Function" | ||
import * as U from "./util" | ||
|
||
describe("FlatMap", () => { | ||
it("pipe", () => { | ||
const f = (n: number): number => n + 1 | ||
const g = U.double | ||
U.deepStrictEqual(_.pipe(2), 2) | ||
U.deepStrictEqual(_.pipe(2, f), 3) | ||
U.deepStrictEqual(_.pipe(2, f, g), 6) | ||
U.deepStrictEqual(_.pipe(2, f, g, f), 7) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g), 14) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f), 15) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f, g), 30) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f, g, f), 31) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f, g, f, g), 62) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f, g, f, g, f), 63) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f, g, f, g, f, g), 126) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f, g, f, g, f, g, f), 127) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f, g, f, g, f, g, f, g), 254) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f, g, f, g, f, g, f, g, f), 255) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f, g, f, g, f, g, f, g, f, g), 510) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f, g, f, g, f, g, f, g, f, g, f), 511) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f, g, f, g, f, g, f, g, f, g, f, g), 1022) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f, g, f, g, f, g, f, g, f, g, f, g, f), 1023) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f, g, f, g, f, g, f, g, f, g, f, g, f, g), 2046) | ||
U.deepStrictEqual(_.pipe(2, f, g, f, g, f, g, f, g, f, g, f, g, f, g, f, g, f, g, f), 2047) | ||
U.deepStrictEqual( | ||
(_.pipe as any)(...[2, f, g, f, g, f, g, f, g, f, g, f, g, f, g, f, g, f, g, f, g]), | ||
4094 | ||
) | ||
}) | ||
}) |