-
-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz> Co-authored-by: Tim <hello@timsmart.co>
- Loading branch information
1 parent
db89601
commit 8356321
Showing
4 changed files
with
247 additions
and
0 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,29 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
add `Effect.bindAll` api | ||
|
||
This api allows you to combine `Effect.all` with `Effect.bind`. It is useful | ||
when you want to concurrently run multiple effects and then combine their | ||
results in a Do notation pipeline. | ||
|
||
```ts | ||
import { Effect } from "effect"; | ||
|
||
const result = Effect.Do.pipe( | ||
Effect.bind("x", () => Effect.succeed(2)), | ||
Effect.bindAll( | ||
({ x }) => ({ | ||
a: Effect.succeed(x + 1), | ||
b: Effect.succeed("foo"), | ||
}), | ||
{ concurrency: 2 }, | ||
), | ||
); | ||
assert.deepStrictEqual(Effect.runSync(result), { | ||
x: 2, | ||
a: 3, | ||
b: "foo", | ||
}); | ||
``` |
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