3 ms·
Yes, it would be, please fire away. As an OCaml beginner my understanding is that I can do away with needing to understand monadic IO (yet) because OCaml is no
by jasim 8y ago
Yes, it would be, please fire away.
As an OCaml beginner my understanding is that I can do away with needing to understand monadic IO (yet) because OCaml is non-lazy and allows side-effects. I also like monadic parser combinators because they'll allow me to write parsers without the tedium of recursive descent, or being reliant upon parser generators. I have a rough understanding of monads as a purely algebraic abstraction (https://arcanesentiment.blogspot.in/2017/06/purely-algebraic-abstractions.html https://arcanesentiment.blogspot.in/2017/06/purely-algebraic...) and an even vaguer idea as a "representation of computations as values", based on this excellent thread: https://discuss.ocaml.org/t/can-monads-help-me-my-refactor-code-for-an-enhanced-data-structure/1064/5 https://discuss.ocaml.org/t/can-monads-help-me-my-refactor-c...
But I don't grok it yet, which I'm sure I'll be able to once I find an occasion to use it. I suspect I'll hit that point sooner if I were using Haskell than OCaml though. I'm still collecting analogies (burritos, boxes, "smart pipes") and I want more. If nothing else, it is fun, and contrary to popular opinion, I don't think it distracts me from its essentially abstract nature.
- Drup 8y agoIf you want to grok monads as an OCaml programmer, there is a very simple solution: do some concurrent/system programming. Both Lwt and Async are monadic, but they are presented without requiring you to know about monads, so you can get to use them pretty easily, and after you've used them to build reasonably sized programs, then you'll have a good intuition of what's happening.
- KirinDave 8y agoSorry I didn't get back right away, but I did answer this to someone else in a more generic context. https://news.ycombinator.com/item?id=17008877 https://news.ycombinator.com/item?id=17008877 Ocaml folks have an awesome async library that is monadic, and I think maybe for OCaml specifically and Ocaml-specific value propositions, playing with that is better than any wall of text I can throw at you. But: parameterizing on a generic monad is what really is the superpower they give you.