patterns_talk icon indicating copy to clipboard operation
patterns_talk copied to clipboard

comonad example: _.chain(), value()

Open jasonm opened this issue 11 years ago • 1 comments

no idea if this is something to put in your talk, but I was reading the docs for underscore.js' chain() and value() today and thought "hmm, does chain return a monad?" Turns out it's a comonad, so if you wanna talk about those, this might be a good example that's familiar to many JS programmers.

http://stackoverflow.com/questions/10431999/does-the-chain-function-in-underscore-js-create-a-monad

jasonm avatar Feb 27 '14 23:02 jasonm

That is the absolute best comonad example I've ever seen! Thanks so much for that.

Gabriel Gonzalez wrote a really neat OO -> FP look at comonads: http://www.haskellforall.com/2013/02/you-could-have-invented-comonads.html

I wonder if a js port would drive it home with the variety of examples...

DrBoolean avatar Feb 28 '14 03:02 DrBoolean