ocamllabs / ocaml-modular-implicits

OCaml extended with modular implicits
Other
103 stars 8 forks source link

Switch Pprintast over to the new syntax. #41

Closed yallop closed 8 years ago

yallop commented 9 years ago

Test input:

module type S

module M : sig
  val f : {X:S} -> int -> int
  implicit module M {X:S} : S
end =
struct
  let rec f : {X:S} -> int -> int
    = fun {X:S} y -> f {X} y
  implicit module M {X:S} = X
end

-dsource output before:

module type S  = sig  end;;

module M :
  sig val f : (implicit X : S) -> int -> int implicit functor M : (X : S) S
  end =
  struct
    module N = struct  end
    let rec f: (implicit X : S) -> int -> int =
      fun (implicit X : (X : S))  -> fun y  -> f (implicit N) y
    implicit functor M (X : S)  = X 
  end ;;

-dsource output after:

module type S
module M :
  sig val f : {X : S} -> int -> int implicit module M {X : S} : S end =
  struct
    let rec f: {X : S} -> int -> int =
      fun {X : (X : S)}  -> fun y  -> f {X} y
    implicit module M {X : S}  = X 
  end 

Note: this doesn't fix issue #7, so the implicit argument syntax is still invalid.