3 ms·
Haskell is dogmatic. Everything must be lazy. Everything must be immutable. Everything must be pure. Ocaml (and SML) aren't particularly dogmatic. They are bot
by hajile 8y ago
Haskell is dogmatic. Everything must be lazy. Everything must be immutable. Everything must be pure.
Ocaml (and SML) aren't particularly dogmatic. They are both eager, so reasoning about performance is much easier. Most things are immutable by default, but you can make mutable data structures in both. Rather than insisting on pure functions, SML and Ocaml allow side effects in functions and have the `unit` type for functions without a return.
The type system is actually strong (eg, no implicit casts) and null exceptions simply do not exist. Multi-threading is the big weakness. Ocaml has been promising support for at least a decade without mainline support. Likewise, most SML variants don't have support (though PolyML does along with a couple others).
- deleted 8y ago[deleted]
- elbear 8y agoThe first one, about everything having to be lazy, isn't true. You can define strict data types or functions. The other two are though.
- sudomakeup 8y agoYou can still have mutable references and impure functions in Haskell, but its not like "path of least resistance" of other languages. The IO type marks impure functions Also one can use STRef if they want to have a pure function that is internally implemented with mutable values - that is all the side effects are self contained. http://gamasutra.com/view/news/169296/Indepth_Functional_programming_in_C.php http://gamasutra.com/view/news/169296/Indepth_Functional_pro... "a function can still be pure even if it calls impure functions, as long as the side effects don't escape the outer function"