Conversation

Being able to separate interfaces from implementations, and hide internal representations is so powerful. I wish more people knew about this stuff! I find OCaml's implementation clunky in many ways, but yeah, I still really like it in general. :)
2
6
Standard ML and Ocaml have the best module systems I've ever come across, and cannot be praised without mentioning functors. I've loved them even more since Ocaml added local opens (which Merlin supports beautifully).
1
Now I just want to know how typeclasses can be added in a way that respects the sort of modularity that Ocaml demands, whilst respecting canonicity and preventing orphans. Not sure where we're at with those constraints.
2
Replying to
We could have a version of Haskell where orphan instances are banned outright. I've got a sense that this would be complicated in an ML-style module system, but my thoughts aren't very clear.
1
Rust has rules to prevent this – it might be interesting to look there. Not sure what rules ‘modular typeclasses’ enforced, but maybe you could come up with a variant that works more like Rust.
1
Show replies