Git Product home page Git Product logo

fp-ts-stream's Introduction

Streams for fp-ts

This library provides Stream and AsyncStream type classes which uses Generator and AsyncGenerator internally, therefore enabling the developers to have transducers, that are executed as much as they are used. See the following example:

import { range, filter, map, take, toArray } from 'fp-ts-stream/Stream'
import { pipe } from 'fp-ts/lib/function'

// The following will only run/execute the `range` iterator only 4 times.
//
// No array will be allocated, until `toArray` and the rest of the iteration
// will be skipped/not completed.
pipe(
  range(0, 10000),            // iterates 4 times
  filter(it => it % 2 == 1),  // iterates 2 times
  map(it => it * 3),          // ...
  take(2),                    // ...
  toArray,                    // executed once
  console.log
)

The Stream is implementing all the functions that an array would normally have, therefore the instances of it admit implementations such as Traversable, Chain and etc.


Support

To support the project, you can send donations to following addresses:

- Bitcoin     : bc1qtut2ss8udkr68p6k6axd0na6nhvngm5dqlyhtn
- Bitcoin Cash: qzmmv43ztae0tfsjx8zf4wwnq3uk6k7zzgcfr9jruk
- Ether       : 0xf542BED91d0218D9c195286e660da2275EF8eC84

fp-ts-stream's People

Contributors

incetarik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

olaoluwam

fp-ts-stream's Issues

Tests and docs

Thank you for this library!
Could you please add tests and docs for it?)

Example code in readme doesn't work.

The example code in the readme doesn't work - fp-ts doesn't have a pipe function toArray is probably missing from the import. Also has type errors. I tried ramda's pipe function, but the code didn't work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.