3 ms·
As someone who has dabbled in Ocaml but has more experience with Haskell typeclasses and Rust traits, is there a good primer on what Ocaml modules are and how t
by tremon 4y ago
As someone who has dabbled in Ocaml but has more experience with Haskell typeclasses and Rust traits, is there a good primer on what Ocaml modules are and how they're supposed to be used? Just porting my previous assumptions on traits/typeclasses over to Ocaml hasn't led me to very satisfying results.
- sausagefeet 4y agoI'm not aware of any particular document, know. I have just read the language spec for modules. I know that sounds scary but, IMO, it's very approachable. And then, I think you just need to play with it to get a feel for me. But maybe someone else has a better introduction. But I think typeclasses and traits are about polymorphism, and that isn't what modules are about, they are about encapsulating code. https://v2.ocaml.org/releases/4.14/htmlman/modtypes.html https://v2.ocaml.org/releases/4.14/htmlman/modtypes.html https://v2.ocaml.org/releases/4.14/htmlman/modules.html https://v2.ocaml.org/releases/4.14/htmlman/modules.html https://v2.ocaml.org/releases/4.14/htmlman/firstclassmodules.html https://v2.ocaml.org/releases/4.14/htmlman/firstclassmodules...