Re:An OCaml manifesto – Problems and what's needed for wides...
by pklausler on Thursday March 31, 2016 @01:44PM
(#11399043)
Sincere question: as a Haskell programmer, why should I also learn/use O'Caml?
[ Parent
| on HN ]
Re:An OCaml manifesto – Problems and what's needed for wides...
by bru on Thursday March 31, 2016 @01:46PM
(#11399058)
Some differences are outlined in this insightful post: http://roscidus.com/blog/blog/2013/06/09/choosing-a-python-r...
Overall I'd say that OCaml is more pragmatic.
Re:An OCaml manifesto – Problems and what's needed for wides...
by pklausler on Thursday March 31, 2016 @02:08PM
(#11399236)
Thanks for the link, will read soon.
Re:An OCaml manifesto – Problems and what's needed for wides...
by bgar on Thursday March 31, 2016 @02:50PM
(#11399566)
I'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
Re:An OCaml manifesto – Problems and what's needed for wides...
by pauldirac137 on Thursday March 31, 2016 @02:52PM
(#11399590)
Agree 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.
Re:An OCaml manifesto – Problems and what's needed for wides...
by adamwk on Thursday March 31, 2016 @02:07PM
(#11399222)
One 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.
Re:An OCaml manifesto – Problems and what's needed for wides...
by lomnakkus on Friday April 01, 2016 @01:25PM
(#11406674)
Interestingly, 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.
Re:An OCaml manifesto – Problems and what's needed for wides...
by pklausler on Thursday March 31, 2016 @02:22PM
(#11399344)
I 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.