# fp-ts-do

> Do-notation implemented with generators for fp-ts ecosystem.

Latest version **1.0.2** (published 2023-03-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install fp-ts-do
pnpm add fp-ts-do
yarn add fp-ts-do
bun add fp-ts-do
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2023-03-30 |
| First published | 2023-03-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 57.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | khraks_mamtsov |
| Keywords | fp-ts, do-notation, generator |

## Links

- npm: https://www.npmjs.com/package/fp-ts-do
- Repository: https://github.com/KhraksMamtsov/fp-ts-do
- Homepage: https://github.com/KhraksMamtsov/fp-ts-do#readme
- Issues: https://github.com/KhraksMamtsov/fp-ts-do/issues
- npm.io page: https://npm.io/package/fp-ts-do

## Recent versions

- 1.0.2 (latest) — 2023-03-30
- 1.0.1 — 2023-03-30
- 1.0.0 — 2023-03-30

## README

# fp-ts-do

Do-notation implemented with generators for fp-ts ecosystem.
Resume function `$` works like `pipe` - it useful for handling not targeted monad parameters:
For example - mapping errors in-place in Either

```typescript
import * as E from 'fp-ts/Either'
import * as RTE from 'fp-ts/ReaderTaskEither'

Do(E.Monad)(function* ($) {
  const a = yield* $( // $ === pipe
    MyEitherNumber, // Either<0, 1> 
    E.mapLeft(() => -1)
  ); // Either<-1, 1>
  const b = yield* $(MyEitherString); // Either<'L', 'R'>
  return [a, b];
}); // Either<-1 | 'L', [1, 'R']>

Do(RTE.Monad)(function* ($) { 
  const a = yield* $(MyRTENumber); // RTE<{n: number}, 0, 1>
  const b = yield* $(MyRTEString); // RTE<{s: string}, 'L', 'R'>
  return [a, b];
}); // RTE<{n: number;} & {s: string;}, 0 | 'L', [1, 'R']>
```

---
_Source: https://npm.io/package/fp-ts-do · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
