Modular Implicits

From the OCaml Labs wiki
Jump to: navigation, search


A common criticism of OCaml is its lack of support for ad-hoc polymorphism. The classic example of this is OCaml's separate addition operators for integers (+) and floating-point numbers (+.). Another example is the need for type-specific printing functions (print_int, print_string, etc.) rather than a single print function which works across multiple types.

Our modular implicits prototype was initially developed between Jan 2014 - Feb 2015.

Taking inspiration from Scala's implicits and [ Modular Type Classes], we propose a system for ad-hoc polymorphism in OCaml based on using modules as type-directed implicit parameters. You can try out an interactive REPL of a prototype implementation online.