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
- Host: GitHub
- URL: https://github.com/zhentian-wan/fp-crocks-demo
- Owner: zhentian-wan
- Created: 2018-05-10T19:21:36.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-14T08:32:00.000Z (over 7 years ago)
- Last Synced: 2025-01-10T19:44:48.354Z (10 months ago)
- Topics: crocks, functional-programming, javascript
- Language: JavaScript
- Size: 32.2 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)