[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] Module inclusion error in 4.01



On 6 December 2013 22:25, Anil Madhavapeddy <anil@xxxxxxxxxx> wrote:
> Dave and I are seeing a new error with 4.01.0 with this standalone MLI file 
> in mirage-types (it works with 4.00.1):
>
> https://raw.github.com/djs55/mirage-types/2634b03bcf99f0aba9696ede5a60bf8b67f0db30/lib/v1.mli
>
> File "lib/v1.mli", line 250, characters 4-23:
> Error: This variant or record definition does not match that of type error
>        Their kinds differ.
> Command exited with code 2.

This is due to the fix for PR6005
(http://caml.inria.fr/mantis/view.php?id=6005).  There's also some
useful discussion under PR6159.  The high-level summary is that you
can't use destructive substitution to replace concrete types in
signatures with incompatible types, although OCaml versions before
4.01.0 didn't properly enforce that.

The simplest fix is to simply leave the error type abstract until the
leaf module types.  There's a slightly neater approach in this case,
though: make the error type in KV_RO a private row, and extend it in
FS.  The definition of error in KV_RO would then be

  type error =
    private [> `Unknown_key of string ]

and the definition of error in FS would become

  type error = [
    | `Not_a_directory of string
    (* ... *)
    | `Block_device of block_device_error
    | `Unknown_key of string
  ]

(The minor downside is that callers of KV_RO.read would need to handle
both `Error (`Unknown_key s) and some unspecified/unknowable set of
tags.)

Jeremy.

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.