This repository exists in order to hold OCaml variants for modular explicits and modular implicit
opam repo add modular-variants git+https://github.com/samsa1/modular-compiler-variants.git
opam switch create 5.2.0+modular-explicits --repos modular-variants,default
To have modular explicit and type arguments for modules, use the branch :
opam switch create 5.2.0+modexp+typearg --repos modular-variants,default
For testing modular implicits prototype :
opam switch create 5.2.0+dev+modular-implicits --repos modular-variants,default
Uses a new syntax
let f
: {M : Typ} -> M.t -> M.t
= fun {M : Typ} (x : M.t) -> x
Uses the same syntax as first-class modules and has fewer bugs
let f
: (module M : Typ) -> (module Typ) -> M.t -> M.t
= fun (module M : Typ) (module N : Typ) (x : M.t) = x
Modular explicits introduce a new type (module M : S) -> t
where M
can appear
in t
. It is a module dependent arrow.
The types (module M : S) -> t
and (module S) -> t
are compatible if M
does
not appear in t
. Thus, modular explicits extend first-class modules by improving
their expressivity without changing how the user writes functions (this only impact types).
A small library to help people use modular explicits (with branch 5.2.0+modular-explicits
) can be installed using :
opam install modexp_lib
An example of printing using this library is available in the example folder. More information about this library can also be found on its repository modexp-stdlib.