Version française
Home     About     Download     Resources     Contact us    
Browse thread
Piece composition of signatures (& problems derived from them too!)
[ 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: Piece composition of signatures (& problems derived from them too!)
> # module type MIXED =
>   sig
> 	  include ORDER
> 	  include TOTAL with type t = t (* THIS IS THE PROBLEM *)
>   end;;
> 
> module type MIXED =
>   sig
>     type t
>     val <= : t -> t -> bool
>     type t = t
>     val compare : t -> t -> int
>   end
> 
> Characters 31-91:
> Signature mismatch:
> Modules do not match:
>   sig
>     type t = int
>     val <= : 'a -> 'a -> bool
>     val compare : int -> int -> int
>   end
> is not included in
>   MIXED
> Type declarations do not match: type t = int is not included in type t = 
> t
> 
> The problem seems to be that the second "t" hides the first or the type 
> equation t = int vanishes.

I suspect neither of your assumptions is correct. The problem is that
your module type MIXED includes two(!) type variables named t (look
carefully at the output of the compiler) while your implementation
only provides one. Probably the compiler should already flag your
definition of MIXED as an error because the name t is defined twice in
the environment. (BTW try to enter the expande of the compiler into the
compiler and it will happily barf on you :-)

Regards
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