haskind
Tried and true Haskell functions for use in Javascript
.oO( or at least as close as we can get )
Description
This project uses Flow types and some functional magic to provide a set of functions closely mimicking the libraries provided by Haskell.
I keep track of weird compatibility issues in my notes.
Get Started
If you wanna get started as soon as possible, try hkci, a preloaded repl!
otherwise, install the library from npm:
npm install --save haskind
Usage
Require your favorite Haskell modules through import.
import { Data } from 'haskind';
const { Just, Nothing, catMaybes } = Data.Maybe;
const { reverse } = Data.List
const maybes = [ Just(3), Nothing(), Just(5) ]
console.log(reverse(catMaybes(maybes))); // [ 5, 3 ]
Note
This lib is still in heavy development. Some functions/tricks are definitely missing. Things like fmap
, which can be applied across multiple types, has still not been fleshed out.
Contributing
If you see something you want to fill in, or think is off, feel free to submit a PR.
Alternatives
Haskind was heavily inspired by Ramda, Lodash and Haskell.Base.
License
Copyright © 2016 Erik Sutherland. All rights reserved.