Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* module type...
@ 2004-11-11  8:35 Pietro Abate
  2004-11-11  8:56 ` [Caml-list] " skaller
  0 siblings, 1 reply; 10+ messages in thread
From: Pietro Abate @ 2004-11-11  8:35 UTC (permalink / raw)
  To: ocaml ml

Hi all,
I've a problem that boils down to this code below.

If I define
			
(* -------------- *)
module TermType =
    struct
        type t = int
        let copy t = t
        let to_string t = "this is a string"
    end
;;

let l : TermType.t list = [1;2];;

(* -------------- *)

everything is ok. and I get 
val l : TermType.t list = [1; 2]

but if I define:

(* -------------- *)
module type ElType =
    sig
        type t
        val copy : t -> t
        val to_string : t -> string
    end
;;
module TermType : ElType =
    struct
        type t = int
        let copy t = t
        let to_string t = "this is a string"
    end
;;
let l : TermType.t list = [1;2];;

(* -------------- *)

now the compiler tells me that:

This expression has type int but is here used with type TermType.t

but TermType.t should be unified with int...

why ? I can I solve this problem ?

and an other small question... why functor sigs are not defined in the std
library (ie for the Set.Make module ?)

thanks.

p

-- 
++ "All great truths begin as blasphemies." -George Bernard Shaw
++ Please avoid sending me Word or PowerPoint attachments.
   See http://www.fsf.org/philosophy/no-word-attachments.html


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-11-12 16:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-11  8:35 module type Pietro Abate
2004-11-11  8:56 ` [Caml-list] " skaller
2004-11-11  9:09   ` Pietro Abate
2004-11-11  9:48     ` Virgile Prevosto
2004-11-12 16:11       ` Specifying abstract type in a record josh
2004-11-12 16:33         ` [Caml-list] " Luc Maranget
2004-11-12 16:37         ` Aleksey Nogin
2004-11-12 16:37         ` Richard Jones
2004-11-12 16:40         ` Andrew Bagdanov
2004-11-12 16:44         ` Matt Gushee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox