Mentions légales du service

Skip to content

record generation breaks for records after the first one

Compiling

type foo = (a: (), b: ())
type bar = (c: (), d: ())

generates the incorrect OCaml code

(** This file was automatically generated using necroml
    See https://gitlab.inria.fr/skeletons/necro-ml/ for more informations *)

(** The unspecified types *)
module type TYPES = sig
end

(** The interpretation monad *)
module type MONAD = sig
  type 'a t
  val ret: 'a -> 'a t
  val branch: (unit -> 'a t) list -> 'a t
  val bind: 'a t -> ('a -> 'b t) -> 'b t
  val fail: string -> 'a t
  val apply: ('a -> 'b t) -> 'a -> 'b t
end

(** All types, and the unspecified terms *)
module type UNSPEC = sig
  module M: MONAD
  include TYPES

  type foo = {
    b: unit;
    a: unit
  }
  and bar =
    d: unit
    c: unit
end

(** Module defining the specified terms *)
module MakeInterpreter (F : UNSPEC) = struct
  include F
  let ( let* ) = M.bind
end

(** A default instantiation *)
module Unspec (M:MONAD) (T:TYPES) = struct
  exception NotImplemented of string
  include T
  module M = M

  type foo = {
    b: unit;
    a: unit
  }
  and bar =
    d: unit
    c: unit
end


(** The module type for interpreters *)
module type INTERPRETER = sig
  module M:MONAD

  type foo = {
    b: unit;
    a: unit
  }
  and bar =
    d: unit
    c: unit
end

With 3 records only the first one is correctly defined.