I'm going to explain some common monads that you can start using in your javascript today. Monads will help make your code easier to read, more mai...
For further actions, you may consider blocking this person and/or reporting abuse
This looks a excellent library; looking forward to using this. Could you help with the following example?
this appears to give me a
Uncaught TypeError: Cannot read property 'toUpperCase'...
but I imagined it might deal with the error in a similar way to PromisesFor this example the following would be better if you weren't sure if some fields would be available
It seems to looks better with Ramda, isn't it:
PS: thanks a lot for the article
This isn't exactly the same because Ramdas
prop()
does not return a Maybe, so if that prop did not exist then ramda would return an undefined, which will cause problems down the line. Same withhead()
You are totally right. Sorry for my mistake.
The first example could be written:
But I don't like it :-)
Regards
This is so cool.
FYI if you don't quite get the point this article shows, give a taste on Haskell. The monad thing is from Haskell which is an extremely neat programing language.
Great stuff. I'll share this with my brother-in-law because it'll do a great job at explaining some FP fundamentals for us to start another conversation with.
Thanks, really cool example.
A preference for the lib apart from Oncha ?
Thanks! I prefer pratica because I wrote it :)
Thanks so much for this Jason! I've always felt FP was a bit over my head but this is a great little example and explanation. Thanks again 👍
Thanks, I wonder what the implications are for performance?
Typically pretty negligible. The Maybe monad just checks the value against null and undefined and calls the callback function. So, not much happening.
Yes, but you also create a new callback function for each step, and the gc should clean them up.
Hello. My dear for those who do not know what monads is still the same. have to talk about how to make and use but without a lib
I find using Result very neat for modeling AND logic, but what about if I need to branch my logic and provide two different Ok results depending on OR logic?
That should be no problem either, instead of returning Result's you can use values, example: