caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: David MENTRE <dmentre@linux-france.org>
To: Hugo Ferreira <hmf@inescporto.pt>
Cc: "Çagdas Bozman" <cagdas@bozman.fr>,
	"caml-list users" <caml-list@inria.fr>
Subject: Re: [Caml-list] Forcing a Map type: setting the value type
Date: Mon, 2 May 2011 16:46:09 +0200	[thread overview]
Message-ID: <BANLkTik_rdhPLVSDfTOFaKa6mb=3E0OO3w@mail.gmail.com> (raw)
In-Reply-To: <4DBEBD4A.7070406@inescporto.pt>

Hello Hugo,

2011/5/2 Hugo Ferreira <hmf@inescporto.pt>:
> Maybe I did not express myself correctly.
> The above would also work with any other type for the
> parameter 'a. I want only integers for it. So:
>
> # let m = IntMap.empty;;

Just do:

 # let m : int IntMap.t = IntMap.empty;;

The " : int IntMap.t" type annotation restricts the default "'a
IntMap.t" of IntMap.empty.

> # let m = IntMap.add 1 "42" m;;

Then:

 # let m = IntMap.add 1 "42" m;;
Characters 26-27:
  let m = IntMap.add 1 "42" m;;
                            ^
This expression has type int IntMap.t but is here used with type
  string IntMap.t


Best regards,
david

  reply	other threads:[~2011-05-02 14:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-02 13:49 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 [this message]
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='BANLkTik_rdhPLVSDfTOFaKa6mb=3E0OO3w@mail.gmail.com' \
    --to=dmentre@linux-france.org \
    --cc=cagdas@bozman.fr \
    --cc=caml-list@inria.fr \
    --cc=hmf@inescporto.pt \
    /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;
as well as URLs for NNTP newsgroup(s).