chrissrogers / maybe

Maybe monad for JavaScript. Never null again.
199 stars 8 forks source link

Be a monad? #10

Open danwdart opened 5 years ago

danwdart commented 5 years ago

Could this implement fmap, >>=, return, pure, <*>, etc? It should be a monad, but currently I cannot map over it or anything.

Thank you

chrissrogers commented 5 years ago

Hi @danwdart and thanks for the attention. I wonder if perhaps you're thinking of other language conventions when mentioning these syntaxes? Those keywords and operations are not implemented in JavaScript, thus we're limited more or less to conventions of purity.

At least that was the case when this library was first written.

I think a good goal to strive for would be compliance with fantasyland/fantasy-land At this time, there is a good Maybe implementation that complies, in sanctuary-js/sanctuary-maybe. Perhaps give that library a spin to see if it meets your needs more?

danwdart commented 5 years ago

Aha - thank you and yes to all of the above.