caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Forcing a Map type: setting the value type
@ 2011-05-02 13:49 Hugo Ferreira
       [not found] ` <BANLkTikn+xxaBeBC0nW0=XFibbcwbC-VFQ@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Hugo Ferreira @ 2011-05-02 13:49 UTC (permalink / raw)
  To: caml-list users

Hello,

I would like to make a Map with the key = int and
and the value also equal to int. Is this possible?
The example below does not work.

TIA,
Hugo F.


# module Domains : Map.S with type key = int
                          with type (+'a) t = int = Map.Make( Int );;
Error: Signature mismatch:
        Modules do not match:
          sig
            type key = Int.t
            type 'a t = 'a Map.Make(Int).t
            val empty : 'a t
            val is_empty : 'a t -> bool
            val add : key -> 'a -> 'a t -> 'a t
            val find : key -> 'a t -> 'a
            val remove : key -> 'a t -> 'a t
            val mem : key -> 'a t -> bool
            val iter : (key -> 'a -> unit) -> 'a t -> unit
            val map : ('a -> 'b) -> 'a t -> 'b t
            val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
            val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
            val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
            val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
          end
        is not included in
          sig
            type key = int
            type 'a t = int
            val empty : 'a t
            val is_empty : 'a t -> bool
            val add : key -> 'a -> 'a t -> 'a t
            val find : key -> 'a t -> 'a
            val remove : key -> 'a t -> 'a t
            val mem : key -> 'a t -> bool
            val iter : (key -> 'a -> unit) -> 'a t -> unit
            val map : ('a -> 'b) -> 'a t -> 'b t
            val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
            val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
            val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
            val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
          end
        Type declarations do not match:
          type 'a t = 'a Map.Make(Int).t
        is not included in
          type 'a t = int


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

end of thread, other threads:[~2011-05-02 15:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-02 13:49 [Caml-list] Forcing a Map type: setting the value type Hugo Ferreira
     [not found] ` <BANLkTikn+xxaBeBC0nW0=XFibbcwbC-VFQ@mail.gmail.com>
2011-05-02 14:18   ` Hugo Ferreira
2011-05-02 14:46     ` David MENTRE
2011-05-02 15:15       ` Gabriel Scherer
2011-05-02 15:33         ` Hugo Ferreira

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).