4 ms·
Sincere question: as a Haskell programmer, why should I also learn/use O'Caml?
by pklausler 11y ago
Sincere question: as a Haskell programmer, why should I also learn/use O'Caml?
- bru 11y agoSome differences are outlined in this insightful post: http://roscidus.com/blog/blog/2013/06/09/choosing-a-python-replacement-for-0install/ http://roscidus.com/blog/blog/2013/06/09/choosing-a-python-r... Overall I'd say that OCaml is more pragmatic.
- pklausler 11y agoThanks for the link, will read soon.
- adamwk 11y agoOne advantage ML has over Haskell is that it's not opinionated on how one manages effects. How effects are managed in ML is a design decision by a library author, whether that be monadic or eff-style or sprinkling a printf here and there.
- pklausler 11y agoI know Standard ML, and yes, it has eager evaluation and modifiable references. I've learned to appreciate lazy evaluation and purity, so those have little value to me. I miss parameterized modules, as Haskell's modules are strictly for namespaces. But I'm pretty clueless on the delta from SML to modern OCaml, so maybe I've missed out on valuable developments.
- lomnakkus 11y agoInterestingly, that's also a disadvantage since you cannot control effects (in the user-supplied code) if you're e.g. writing a library API with callbacks. On the advantage side you have what you mentioned, namely "benign" effects -- but I've found that the "sprinkle a few debug printfs" use case is adequately handled with Debug.Trace... unless you're trying to debug a terminal application! :) Logging is another popular example of a "benign" effect, but I personally don't think is: I mean, your logging library could be doing all kinds of weird things like shipping logs over TCP to a remote syslog daemon... and I don't want that to be hidden under the rug (using unsafePerformIO or similar) only to blow up later when the network happens to be down. Anyway, having programmed in O'Caml for 3-4 years, I was won over to Haskell by the compiler-supported (side) effect tracking. I think it's also important to note the distinction between side effects and plain (desired) effects. Not enough people do this in these sorts of discussions.
- bgar 11y agoI'm also a Haskeller, and have been writing OCaml for a few months. Some things I liked include (1) really straightforward imperative programming (2) really straightforward mutable data structures like hash tables (3) module system (sort of like typeclasses but much more expressive) (4) named parameters (5) easy-to-understand/straightforward assembly (6) eager by default
- pauldirac137 11y agoAgree with everything you said, and I'd also add polymorphic variants. I too am a Haskeller now writing mostly Ocaml. I view the two languages as cousins. Both have great features the other doesn't. Both are worth learning and using.