type contraints between module signatures

From: Georges Brun-Cottan (bruncott@cs.brandeis.edu)
Date: Thu Sep 30 1999 - 23:23:14 MET DST


Date: Thu, 30 Sep 1999 17:23:14 -0400
Message-Id: <199909302123.RAA20060@lachesis.cs.brandeis.edu>
From: Georges Brun-Cottan <bruncott@cs.brandeis.edu>
To: caml-list@inria.fr
Subject: type contraints between module signatures

Hi,

I have two signatures A and B. I would like to constrain the
signature B with a type defined in A. I cannot succeed.

** foo.ml **
module type A = sig
  type op_t
  type state
  type view

  type upcalls = {
      install_state : state -> unit;
      get_state : unit -> state;}

  val install : view -> unit
end

module type B = sig
  val install : A.upcalls -> unit
end
***

<lachesis>ocamlc -c foo.ml
File "foo.ml", line 14, characters 16-25:
Unbound type constructor A.upcalls

I would like to constrain B.install to accept only A.upcalls
parameters. What's wrong?

Is this relates to the recent `Parameterized signatures needed ?'
thread?.

Thanks,

-- Georges

PS: Just to precise the point, here is the real example. The problem
is with Replica_intf.protocol_upcalls in the Protocol_intf.install
signature.

module type Replica_intf = sig
  open Ensemble
  open View

  type op_t
  type state
  type metrics
  type view = View.full
  type acker = op_t -> unit
  type op_generator = unit -> (op_t * acker) option

  type protocol_upcalls = {
      install_state : state -> unit;
        get_state : unit -> state;
          getnewop : op_generator; }
        
  type handlers = {
      upcalls : protocol_upcalls ;
      heartbeat : Time.t -> unit; }

  val mu : op_t -> metrics
  val execute : op_t -> bool

  val install : view -> handlers
  val to_string : op_t -> string
  val dump : unit -> unit
end

open Replica_intf

module type Protocol_intf = sig
  open Ensemble
  open Appl_intf
  open New
  open Trans
  open Util

  open Replica_intf

  type operation
  type metrics
  type upcalls

  type handlers = {
      deliver : origin -> cast_or_send -> operation -> (operation naction) list;
        fetch : unit -> (operation naction) list;
          dump : unit -> unit;
            stable : unit -> bool;
    }

  val install :
      View.full -> bool -> Replica_intf.protocol_upcalls -> int -> metrics ->
        (operation naction list) * handlers
end



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:25 MET