Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: CSL modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Wolfgang Lux <lux@h...>
Subject: Re: CSL modules

> This is easily done using a signature constraint to specify exactly
> how much of C should remain visible:
> 
> module type SIGA =
>   sig
>     type ta = A | B of int
>     val xa : ta
>   end
> module type SIGB =
>   sig
>     type tb = C | D of string
>     val xb : tb
>   end
> 

[ alternate (and better) definition of SIGC and F deleted]

> module type SIGC =
>   sig
>     type ta = A.ta              (* concrete *)
>     type tb                     (* abstract *)
>     val xa : ta
>     val xb : tb
>   end
> module F(A: SIGA)(B: SIGB) =
>   (struct
>      type ta = A.ta
>      type tb = B.tb
>      let xa = A.xa
>      let xb = B.xb
>    end : SIGC)
> module C = F(A)(B)
> 

Being curious I tried this and got an error from CSL 1.14, which I
really don't understand. After defining SIGA and SIGB and the
following two sample modules

module A : SIGA =
  struct
    type ta = A | B of int
    let xa = B 4
  end
module B : SIGB =
  struct
    type tb = C | D of string
    let xb = D "hello"
  end

I can define SIGC, but when I enter the definition of F, CSL returns
the following error:

Signature mismatch:
Modules do not match:
  sig type ta = A.ta type tb = B.tb val xa : A.ta val xb : B.tb end
is not included in
  SIGC
Type declarations do not match:
  type ta = A.ta
is not included in
  type ta = A.ta

Any clues?

Wolfgang

----
Wolfgang Lux
WZH Heidelberg, IBM Germany             Internet: lux@heidelbg.ibm.com
+49-6221-59-4546                        VNET:     LUX at HEIDELBG
+49-6221-59-3500 (fax)	                EARN:     LUX at DHDIBMIP