https://github.com/EasyCrypt/easycrypt
Revision 64c24ed6d2c0b485818e0ae76c4be0ebde0e628a authored by Benjamin Gregoire on 26 April 2018, 18:31:53 UTC, committed by Benjamin Gregoire on 26 April 2018, 18:31:53 UTC
The following is now possible:
type t, t', u, u', v, v'.

module type OT = {
  proc f(_: t): t'
  proc g1(_: t): t'
}.

module type MT (O : OT) = {
  include OT
  proc g(_: u): u'
}.

module type MT1 (O : OT) = {
  include OT [f]
  proc g(_: u): u'
}.

module type MT2 (O : OT) = {
  include OT [f] {O.f}
  proc g(_: u): u'
}.

module type MT3 (O : OT) = {
  include OT [f] {O.g1}
  proc g(_: u): u'
}.

module ((M : MT1):MT2) (O : OT) = {
  proc f = O.f

  proc g(x: u): u' = {
    return witness;
  }
}.

module M1 = {
  proc f () : unit = { }
  proc g () : unit = { }
}.

module M2 = {
  include M1
}.

module M3 = {
  include M1 [f]
}.

module M4 = {
  include M1 [+f]
}.

module M5 = {
  include M1 [-f]
}.

module F (O:OT) = {
  proc f1 () = {}
}.

module G (O:OT) = {
  include O
  include F(O)
}.

module G1 (O:OT) = {
  include O [-f]
  include F(O)
}.
1 parent 7f33e2a
Raw File
Tip revision: 64c24ed6d2c0b485818e0ae76c4be0ebde0e628a authored by Benjamin Gregoire on 26 April 2018, 18:31:53 UTC
improve "include" in module type and module.
Tip revision: 64c24ed
myocamlbuild.ml
open Ocamlbuild_plugin

let _ = dispatch begin function
   | After_options ->
       Options.ocamlc   := S[!Options.ocamlc  ; A"-rectypes"];
       Options.ocamlopt := S[!Options.ocamlopt; A"-rectypes"];

   | After_rules ->
       (* Numerical warnings *)
       begin
         let wflag error mode wid =
           let mode = match mode with
             | `Enable  -> "+"
             | `Disable -> "-"
             | `Mark    -> "@"
           in
             match error with
             | false -> S[A"-w"; A(Printf.sprintf "%s%d" mode wid)]
             | true  -> S[A"-warn-error"; A(Printf.sprintf "%s%d" mode wid)]
         in
           for i = 1 to 59 do
             flag ["ocaml"; "compile"; Printf.sprintf "warn_+%d" i] & (wflag false `Enable  i);
             flag ["ocaml"; "compile"; Printf.sprintf "warn_-%d" i] & (wflag false `Disable i);
             flag ["ocaml"; "compile"; Printf.sprintf "warn_@%d" i] & (wflag false `Mark    i);
             flag ["ocaml"; "compile"; Printf.sprintf "werr_+%d" i] & (wflag true  `Enable  i);
             flag ["ocaml"; "compile"; Printf.sprintf "werr_-%d" i] & (wflag true  `Disable i);
             flag ["ocaml"; "compile"; Printf.sprintf "werr_@%d" i] & (wflag true  `Mark    i)
           done
       end;

       (* menhir & --explain/--trace/--table *)
       flag ["ocaml"; "parser"; "menhir"; "menhir_explain"] & A"--explain";
       flag ["ocaml"; "parser"; "menhir"; "menhir_trace"  ] & A"--trace";
       flag ["ocaml"; "parser"; "menhir"; "menhir_table"  ] & A"--table";

       (* Threads switches *)
       flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]);
       flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]);

       (* Bisect *)
       flag ["ocaml"; "compile" ;  "bisect"] & S[A"-package"; A"bisect"];
       flag ["ocaml"; "compile" ;  "bisect"] & S[A"-syntax" ; A"camlp4o"];
       flag ["ocaml"; "compile" ;  "bisect"] & S[A"-syntax" ; A"bisect_pp"];
       flag ["ocaml"; "ocamldep";  "bisect"] & S[A"-package"; A"bisect"];
       flag ["ocaml"; "ocamldep";  "bisect"] & S[A"-syntax" ; A"camlp4o"];
       flag ["ocaml"; "ocamldep";  "bisect"] & S[A"-syntax" ; A"bisect_pp"];
       flag ["ocaml"; "link"    ;  "bisect"] & S[A"-package"; A"bisect"];

       (* Lint switches *)
       flag ["ocaml"; "lint"; "compile"] (S[A "-ppx"; A "../lint/ppx_lint.native"])

   | _ -> ()
end
back to top