Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/kanitsharma/pokemonads
- Owner: kanitsharma
- Created: 2018-06-02T14:32:09.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T09:37:44.000Z (almost 2 years ago)
- Last Synced: 2024-04-25T01:21:14.403Z (7 months ago)
- Topics: functional-programming, javascript-library, lambda, monads, pointfree
- Language: JavaScript
- Homepage:
- Size: 1.84 MB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 19
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Pokemonads
[](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
```