Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kanitsharma/pokemonads

๐ŸŒˆ Fantasy Land compliant ADTs and combinators
https://github.com/kanitsharma/pokemonads

functional-programming javascript-library lambda monads pointfree

Last synced: 20 days ago
JSON representation

๐ŸŒˆ Fantasy Land compliant ADTs and combinators

Awesome Lists containing this project

README

        

# Pokemonads

[Fantasy Land](https://github.com/fantasyland/fantasy-land/)

Pokemonads is a collection of common algebraic data types and combinators which are compatible with [Fantasy Land](https://github.com/fantasyland/fantasy-land/)

## Fistful of monads and more โœŠ

โ€œOnce you understand monads, you immediately become incapable of explaining them to anyone elseโ€ Lady Monadgreenโ€™s curse ~ Gilad Bracha (used famously by Douglas Crockford)

A monad is a way of composing functions that require context in addition to the return value, such as computation, branching, or I/O. Monads type lift, flatten and map so that the types line up for lifting functions a => M(b), making them composable. It's a mapping from some type a to some type b along with some computational context, hidden in the implementation details of lift, flatten, and map:

- Functions map: `a => b`
- Functors map with context: `Functor(a) => Functor(b)`
- Monads flatten and map with context: `Monad(Monad(a)) => Monad(b)`

Why do we need monads? [here](https://stackoverflow.com/questions/28139259/why-do-we-need-monads) is a great explanation

## [See examples](https://github.com/kanitsharma/pokemonads/blob/master/packages/adts/readme.md)

## Installation

#### ADTs -> Contains all basic monads

```javascript
npm i -s @pokemonads/adts
// or
yarn add @pokemonads/adts
```

#### Combinators -> A collection of basic combinators and utilities

```javascript
npm i -s @pokemonads/combinators
// or
yarn add @pokemonads/combinators
```