JSPM

  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q48713F
  • License MIT

Do like notation for typescript and fp-ts

Package Exports

  • ts-do

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ts-do) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Description

This library works as an extension for fp-ts allowing the usage a 'sort of' do notation

Installation

To install the stable version:

yarn install ts-do

Using the extension

Start by importing the extension:

import "ts-do"

After just use the new methods on the existing types:

import { some } from "fp-ts/lib/Option"

const result = some({})
    .let("x", some(3))
    .for("ys", ({ x }) => range(0, x).map(() => some(1)))
    .return(({ x, ys }) => x - sum(ys))

Check the test folder for a few more examples.