caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* type contraints between module signatures
@ 1999-09-30 21:23 Georges Brun-Cottan
  0 siblings, 0 replies; only message in thread
From: Georges Brun-Cottan @ 1999-09-30 21:23 UTC (permalink / raw)
  To: caml-list

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





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-10-02 17:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-30 21:23 type contraints between module signatures Georges Brun-Cottan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).