littleball-games / lb-f

A collection of functional programming functions
MIT License
0 stars 1 forks source link

Add map and chain to maybes #24

Closed skylize closed 6 years ago

skylize commented 6 years ago

Add map and chain to just and nothing.

Seems like this is working. One thing that's bothering me is how exposed everything is. Should a console log really dump out all the internals like this? We could hide most of this stuff by putting it on a prototype.

Also, with the current implementation, I'm not sure it's possible to do a true chain. I had to use a functionally equivalent shortcut.

console.log(just(2))
//  { 
//    value: 2,
//    type: 'JUST',
//    map: [Function: map],
//    chain: [Function: chain]
//  }
skylize commented 6 years ago

Oh, sorry wrong branch.