Skip to content
🎩 A fast push & pull stream library for Reason, OCaml, and TypeScript
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__ Add basic tests cases for toPromise. May 25, 2019
docs Add initial readme and rename src and package Feb 28, 2018
esy.lock Add dune and esy May 6, 2019
include Add dune and esy May 6, 2019
perf Add naive benchmark suite Jan 28, 2019
scripts Set up Sail CI and Codecov (#22) Jun 8, 2019
src
.codecov.yml Set up Sail CI and Codecov (#22) Jun 8, 2019
.editorconfig Initial commit Feb 26, 2018
.gitignore Auto-generate Flow definitions from TS definitions using flowgen (#16) May 6, 2019
.jest.coverage.json Ensure curried sources and sinks for JS export Jan 14, 2019
.npmignore Add esy.lock to npmignore May 6, 2019
.sail.yml Set up Sail CI and Codecov (#22) Jun 8, 2019
LICENSE.md Add initial readme and rename src and package Feb 28, 2018
README.md Set up Sail CI and Codecov (#22) Jun 8, 2019
bsconfig.json Restructure and vendor bs-rebel for dune build May 6, 2019
dune-project Add dune and esy May 6, 2019
esy.json Add dune and esy May 6, 2019
index.js.flow Auto-generate Flow definitions from TS definitions using flowgen (#16) May 6, 2019
package.json Set up Sail CI and Codecov (#22) Jun 8, 2019
rollup.config.js Replace microbundle with custom Rollup config May 6, 2019
tasks.json Initial commit Feb 26, 2018
wonka.opam Add dune and esy May 6, 2019
yarn.lock Set up Sail CI and Codecov (#22) Jun 8, 2019

README.md

Wonka

A fast push & pull stream library for Reason, loosely following the callbag spec


NPM Version License Test Coverage Minified gzip size

“There’s no earthly way of knowing
Which direction we are going
There’s no knowing where we’re rowing
Or which way the river’s flowing” - Willy Wonka


Wonka

What is Wonka

Wonka is a library for lightweight observables and iterables loosely based on the callbag spec. It exposes a set of helpers to create and transform sources and output sinks, meaning it helps you to turn an event source or an iterable set of data into streams, and manipulate these streams.

Reason has been becoming increasingly popular, but it's missing a good pattern for streams that feels native to the language. The functional nature of callbags make them a perfect starting point to fix this, and to introduce a reactive programming pattern to a language that is well suited for it.

This library also attempts to support as many Reason/JS environments as possible, which makes the adoption of streams across multiple projects a lot easier. Hence Wonka is a library that aims to make complex streams of data easy to deal with.

Compatibility

Wonka is not only compatible with Reason/Bucklescript, but out of the box with other environments as well.

  • TypeScript
  • JS/Flow
  • Reason/OCaml Bucklescript
  • Reason/OCaml bs-native
  • Reason/OCaml Dune

In summary, it should work in any TypeScript/Flow/Reason/OCaml environment with full type safety.

Installation

Install the library first: yarn add wonka or npm install --save wonka,

BuckleScript

For Bucklescript you will also need to add wonka to bs-dependencies in your bsconfig.json file like so:

{
  "name": "<your name>",
  "version": "0.1.0",
  "sources": ["src"],
  "bsc-flags": ["-bs-super-errors"],
  "bs-dependencies": [
+    "wonka"
  ]
}

Documentation

This is still a work-in-progress but will contain full information on the following across all supported languages:

  • The API, i.e. a list of all helpers
  • Examples
  • Usage Guides & Recipes
  • Developer Guides (How to write a source/operator/sink)
  • Modified Callbag spec
You can’t perform that action at this time.