Modular implicits - what's the story here?


#1

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?


#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).


#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.


#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 :frowning:

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


#5

From the OCaml discourse forum: https://discuss.ocaml.org/t/modular-implicits/144/9