4 ms·
> ML is good at what it does but it doesn't offer Haskell's type system. You can do most of Haskell's type trickery in OCaml though. Some things are much easie
by Drup 11y ago
> ML is good at what it does but it doesn't offer Haskell's type system.
You can do most of Haskell's type trickery in OCaml though. Some things are much easier in Haskell, but other things are much harder.
- lmm 11y agoCan you? I use higher-kinded types all the time, and OCaml simply doesn't have them AIUI.
- Drup 11y agoMost examples of HKT in Haskell are either: - not necessary. You don't need HKTs to have >>= for your favorite monad. - encodable in functors/first class modules trivially. - genuinely complicated HKT. The last point happens far less often than Haskell people believe. (It does happen occasionally, though, and it's indeed annoying when it does).
- lmm 11y agoI need HKTs to write something in terms of >>= that will work for more than one monad, no? And I do that all the time.
- wyager 11y agoI really don't see how. There's a ton of useful stuff with HKTs, type families, GADTs, etc that you can't hope to achieve with ocaml's type system. Recently, I've found myself using extensive type-level arithmetic for automatic hardware generation and verification. This requires a number of powerful type system features (type level literals, kind promotion, type functions and equality constraints a la type families, type normalization plugins) that wouldn't work at all in ocaml.