One of the first significant stumbling blocks I encountered with Reason was with ad-hoc polymorphism (I didn’t actually realize that this is what it was called at the time, though). As I understand, modular implicits will be the OCaml answer to ad-hoc polymorphism. Can someone explain what this is, show some example pseudocode and compare/contrast with Haskell type classes?
Modular implicits - what's the story here?
yawaramin
#2
See https://www.reddit.com/r/ocaml/comments/4qan0w/modular_type_classes_vs_modular_implicits/ for a discussion and links to the original papers (the OCaml modular implicits paper is pretty readable).
shinzui
#3
My understanding is that modular implicits are nowhere near ready to be used, it’s just a prototype at this stage. Someone should correct me if I’m wrong.
spyder
#4
I recall seeing a project that used the modular implicits compiler fork to demonstrate what an ocaml stdlib with monads etc might look like. But I can’t find it now
Here’s a very detailed discussion with examples - it’s in ocaml syntax but hopefully you get the idea (or can copy/paste into one of the conversion tools):
tycon.github.io/modular-implicits.html