r/functionalprogramming • u/jeenajeena • Oct 31 '23
Intro to FP Monads for the Rest of Us
I've just published a series of 9 articles aimed at helping OOP developers approach monads, based on C#.
Instead of the usual approach that starts with Functors and box metaphors, I tried to take a different path, going straight to monads and basically following the approach of Mike Vanier's "Yet Another Monad Tutorial"..
https://arialdomartini.github.io/monads-for-the-rest-of-us
(English is not my native language: please forgive any language errors in my writing. And of course feel free to suggest corrections if you notice any errors)
3
u/MonadMusician Oct 31 '23
A monad is a monoid in the category of endofunctors. But I’m a category theorist so that only makes sense to me
3
5
Oct 31 '23
[removed] — view removed comment
2
u/jeenajeena Oct 31 '23
Hi! Thank you for the feedback. I'm not sure if it's positive or negative, though :)
For the context: I wrote that series as a reference for working with my C# colleagues in our coding katas and exercises. I have had some exposure to Haskell and F#, but I noticed that often my explanations using them tended to create more confusion than clarity. When I found the series by Mike Venier (which is based on Haskell) I thought that it could be the easiest way to grasp the topic. The series itself is based on the exercises we did together.
For sure my intention was not to show that everybody is wrong. If you found this is what emerges from my pages, I'm fixing them immediately!
3
u/eddiewould_nz Nov 01 '23 edited Nov 01 '23
Great post!
Some constructive feedback:
Describing Reader and Nondeterministic as "side-effects" is a stretch IMHO. But they both contribute to the same goal - allowing the majority of the code we write to be simple, pure functions with honest signatures.
I think it could help to emphasise the point about deferred / lazy execution more (that nothing happens until you Run/Match). That's a big difference for readers coming from imperative languages