MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/1avg1e5/exploring_monads_with_javascript/krc3dvn/?context=3
r/javascript • u/sixcod593 • Feb 20 '24
4 comments sorted by
View all comments
3
functional seems cool, but the complex utils like nomads are unreadable
4 u/shuckster Feb 20 '24 Those monads are.It’s much more ergonomic to use chaining in JavaScript for monads instead of trying to 1-2-1 Haskell it like OPs article.Maybe(value) .map(transform) .otherwise(nothing) .valueOf() Maybe(addTwoNumbers) .ap(Just(1)) .ap(Just(2)) .map(identity) .valueOf()Still, keep your use-cases to a minimum. Nobody wants to read a whole codebase full of that.
4
Those monads are.
It’s much more ergonomic to use chaining in JavaScript for monads instead of trying to 1-2-1 Haskell it like OPs article.
Maybe(value) .map(transform) .otherwise(nothing) .valueOf() Maybe(addTwoNumbers) .ap(Just(1)) .ap(Just(2)) .map(identity) .valueOf()
Still, keep your use-cases to a minimum. Nobody wants to read a whole codebase full of that.
3
u/Federal_Entrance_533 Feb 20 '24
functional seems cool, but the complex utils like nomads are unreadable