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

https://github.com/zhentian-wan/fp-crocks-demo

Learning Functional Programming library Crocks, Maybe type and more
https://github.com/zhentian-wan/fp-crocks-demo

crocks functional-programming javascript

Last synced: 9 months ago
JSON representation

Learning Functional Programming library Crocks, Maybe type and more

Awesome Lists containing this project

README

          

# Learning FP lib - [crocks](https://github.com/evilsoft/crocks)

### Demos

* Learning how to use `Maybe.Just()` and `Maybe.Nothing()`, and how to unwrap a Functor by using `.option(n)`. | [Code](./demo1.js) | [Blog](http://www.cnblogs.com/Answer1215/p/9022702.html) | [Docs](https://evilsoft.github.io/crocks/docs/crocks/Maybe.html)

* Learning how to use Helper function `safe` and predicates function `isNumber`, `isString`. | [Code](./demo2.js) | [Blog](http://www.cnblogs.com/Answer1215/p/9026265.html) | [Docs](https://evilsoft.github.io/crocks/docs/functions/predicate-functions.html)

* Learning how to use Helper function `prop` to get value from object or array. | [Code](./demo3.js) | [Blog](http://www.cnblogs.com/Answer1215/p/9026342.html) | [Docs](https://evilsoft.github.io/crocks/docs/crocks/Maybe.html#prop)

* Learning how to use Helper function `propPath` for getting nested object value. | [Code](./demo4.js) | [Blog](http://www.cnblogs.com/Answer1215/p/9026452.html) | [Docs](https://evilsoft.github.io/crocks/docs/crocks/Maybe.html#proppath)

* Learning hwo to use Helper instance method `chain` instead of `map`, `chain` known as flatMap in other library. | [Code](./demo5.js) | [Blog](http://www.cnblogs.com/Answer1215/p/9026521.html) | [Docs](https://evilsoft.github.io/crocks/docs/crocks/Maybe.html#chain)

* Learning how to use Instance method `alt` to provide an alternative value for Maybe | [Code](./demo6.js) | [Blog](http://www.cnblogs.com/Answer1215/p/9037350.html) | [Docs](https://evilsoft.github.io/crocks/docs/crocks/Maybe.html#alt)

* Learning how to use Instance method `coalesce` to provdie a default value inside of Maybe | [Code](./demo7.js) | [Blog](http://www.cnblogs.com/Answer1215/p/9037633.html) | [Docs](https://evilsoft.github.io/crocks/docs/crocks/Maybe.html#coalesce)

* Learning how to use `compose` to rewrite |[Code](./demo8.js) | [Blog](http://www.cnblogs.com/Answer1215/p/9037945.html) | [Docs](https://evilsoft.github.io/crocks/docs/functions/helpers.html#composek)

* Learning how to use `ap, liftA2, curry` to apply Maybe context of a function | [Code](./demo9.js) | [Blog](http://www.cnblogs.com/Answer1215/p/9038130.html) | [Docs](https://evilsoft.github.io/crocks/docs/functions/helpers.html#lifta2)

* Learning how to use `safeLift` to replace `safe(pred, n).map(fn)` |[Code](./demo10.js) | [Blog](http://www.cnblogs.com/Answer1215/p/9038215.html) | [Docs](https://evilsoft.github.io/crocks/docs/crocks/Maybe.html#safelift)