Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stevemao/inspect-compose
compose with debuggable glory
https://github.com/stevemao/inspect-compose
Last synced: 6 days ago
JSON representation
compose with debuggable glory
- Host: GitHub
- URL: https://github.com/stevemao/inspect-compose
- Owner: stevemao
- Created: 2017-05-21T01:34:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-21T01:44:12.000Z (over 7 years ago)
- Last Synced: 2024-12-07T19:37:24.855Z (26 days ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Problem
```js
var add = curry(function add(x, y){ return x + y });
var map = curry(function map(f, xs){ return xs.map(f) });
var head = function(xs){ return xs[0] };var inc = add(1);
var incFirst = compose(head, map(inc))
```When trying to `console.log` a function we’re presented with the guts of some internal compose implementation that tells us nothing.
# Before
```js
console.log(incFirst)
// function f(result) {
// for (var i = fns.length - 1; i > -1; i--) {
// result = fns[i].call(this, result);
// }
// return result;
// }
```# After
```js
console.log(incFirst)
// compose(function (xs){ return xs[0] }, map(add(1)))
```See https://medium.com/@drboolean/debugging-functional-7deb4688a08c
# Related
- [inspect-curry](https://github.com/stevemao/inspect-curry)
- [composition-trace](https://github.com/stevemao/composition-trace)