From: Hugo Ferreira <hmf@inescporto.pt>
To: caml-list users <caml-list@inria.fr>
Subject: [Caml-list] Forcing a Map type: setting the value type
Date: Mon, 02 May 2011 14:49:07 +0100 [thread overview]
Message-ID: <4DBEB653.3000002@inescporto.pt> (raw)
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
next reply other threads:[~2011-05-02 13:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-02 13:49 Hugo Ferreira [this message]
[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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DBEB653.3000002@inescporto.pt \
--to=hmf@inescporto.pt \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox