Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davidchase/elmentary
Your one-stop shop for Algebraic Data Types (ADT) in elm :deciduous_tree:
https://github.com/davidchase/elmentary
adts algebraic-data-types elm functional-programming monads monoid
Last synced: 8 days ago
JSON representation
Your one-stop shop for Algebraic Data Types (ADT) in elm :deciduous_tree:
- Host: GitHub
- URL: https://github.com/davidchase/elmentary
- Owner: davidchase
- License: mit
- Created: 2017-01-30T15:59:16.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-11T04:58:15.000Z (almost 8 years ago)
- Last Synced: 2024-10-31T05:51:41.390Z (15 days ago)
- Topics: adts, algebraic-data-types, elm, functional-programming, monads, monoid
- Language: Elm
- Homepage:
- Size: 26.4 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![](https://img.shields.io/badge/functional-%CE%BB-blue.svg?style=flat-square)
[![API stability](https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square)](https://nodejs.org/api/documentation.html#documentation_stability_index)# elmentary
> Your one-stop shop for Algebraic Data Types (ADT) in elm## Why ?
Fun to experiment## Types
### Maybe Type
**reduce** : `(a -> b -> a) -> a -> Maybe b -> a`
**filter** : `(a -> Bool) -> Maybe a -> Maybe a`
**isJust** : `Maybe a -> Bool`
**catMaybes** : `List (Maybe b) -> List b`
**fmap** : `(a -> b) -> Maybe a -> Maybe b`
**chain** : `(a -> Maybe b) -> Maybe a -> Maybe b`
**join** : `Maybe (Maybe a) -> Maybe a`
**ap** : `Maybe (b -> a) -> Maybe b -> Maybe a`
**lift2** : `(b -> c -> a) -> Maybe b -> Maybe c -> Maybe a`
**concat** : `Maybe (List a) -> Maybe (List a) -> Maybe (List a)`
**mapMaybe** : `(a -> Maybe b) -> List a -> List b`
**maybe** : `a -> (b -> a) -> Maybe b -> a`
**empty** : `Maybe a`
**traverse** : `(a -> Maybe b) -> List a -> Maybe (List b)`
**sequence** : `List (Maybe a) -> Maybe (List a)`
### Either Type
**partition** : `List (Either c a) -> ( List c, List a )`
**either** : `(c -> b) -> (a -> b) -> Either c a -> b`
**isLeft** : `Either c a -> Bool`
**isRight** : `Either c a -> Bool`
**rights** : `List (Either c a) -> List a`
**lefts** : `List (Either c a) -> List c`
**fmap** : `(a -> b) -> Either c a -> Either c b`
**chain** : `(a -> Either c b) -> Either c a -> Either c b`
**ap** : `Either c (a -> b) -> Either c a -> Either c b`
**lift2** : `(a -> b -> d) -> Either c a -> Either c b -> Either c d`
**concat** : `Either c (List a) -> Either c (List a) -> Either c (List a)`
**traverse** : `(a -> Either c b) -> List a -> Either c (List b)`
**sequence** : `List (Either c a) -> Either c (List a)`
**toBoolean** : `Either c a -> Bool`
**eitherToMaybe** : `Either c a -> Maybe a`
### Inspired by
[sanctuary](http://sanctuary.js.org)
[crocks](https://github.com/evilsoft/crocks)
[folktale](http://folktalejs.org/)