From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 3EBB4BC57 for ; Mon, 20 Sep 2010 19:31:54 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArcBADM3l0zRVdY2kGdsb2JhbACTdYYOAYgNCBUBAQEBCQkMBxEDH6c9iTyCFIZOLog0AQEDBYU8BIFagyqFNA X-IronPort-AV: E=Sophos;i="4.56,394,1280700000"; d="scan'208";a="59706768" Received: from mail-bw0-f54.google.com ([209.85.214.54]) by mail2-smtp-roc.national.inria.fr with ESMTP; 20 Sep 2010 19:31:53 +0200 Received: by bwz15 with SMTP id 15so7390491bwz.27 for ; Mon, 20 Sep 2010 10:31:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=Dl/iNYqrc+KShXM0cPFbwIbRW4M9u17ul/X5R/JKrz4=; b=HU0YtQM6YrRlptN3URPUCGdE4yJO8tMCrJbCogfjquRoyBA1HUvtvTliOq7Xtj2chH pKW9H0g29xWph95MJnjrJqhF60UQwyxsq7YU2eMm4V2aXOVSnfTUnHpRmOVGSCzueH/s fMIu7ObYf9wL3UN0P/7MfZe+ofWjp5iR9bN74= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=g3E8B5BxC2Hf/qwk4fi0NAa0/WC3iY7trOELngaZ+taQCrgjHEUXQrqiVQAH2jI8dc bj6q9Vz6p3bfLEgD9tcpJTwUpJuZALN2uEUrltJ8kq+RTHHDciLvexZCm+wTPFiOGHXw YaKcfY4k3UYPfhvCRJx74mDcKeoKY3Z+3nDOE= Received: by 10.204.47.38 with SMTP id l38mr6823037bkf.154.1285003913155; Mon, 20 Sep 2010 10:31:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.82.166 with HTTP; Mon, 20 Sep 2010 10:31:33 -0700 (PDT) In-Reply-To: <4C97991F.7030503@inria.fr> References: <4C97714A.6050403@inria.fr> <4C97991F.7030503@inria.fr> From: Ashish Agarwal Date: Mon, 20 Sep 2010 13:31:33 -0400 Message-ID: Subject: Re: [Caml-list] How can I set a type parameter of Map.Make(X) ? To: Dumitru Potop-Butucaru Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary=0016e6d77e7bc755370490b4493b X-Spam: no; 0.00; int's:01 val:01 browsed:01 beginner's:01 ocaml:01 bug:01 beginner's:01 ocaml:01 bug:01 int's:01 val:01 browsed:01 1975:98 20,:98 jacky:98 --0016e6d77e7bc755370490b4493b Content-Type: text/plain; charset=ISO-8859-1 Why do you want to do this? What benefit does it bring that cannot be achieved by leaving the polymorphic type? On Mon, Sep 20, 2010 at 1:25 PM, Dumitru Potop-Butucaru < dumitru.potop_butucaru@inria.fr> wrote: > > Actually, I was looking for a way to specialize a whole module, > not just the associated type (**this** I knew how to do). > I would like to write something like: > > include module type of Set.Make(String) with 'a= int > > Is this possible? > > Yours, > Jacky Potop > > > > > > On 20/09/2010 16:57, Ashish Agarwal wrote: > >> module M = Map.Make(String) >> >> type t = int M.t >> >> Type t is the type of maps from string's to int's. Or alternatively write >> a >> function that assumes 'a is some specific type: >> >> # let f m = M.fold (fun _ x y -> x + y) m 0;; >> val f : int M.t -> int = >> >> >> On Mon, Sep 20, 2010 at 10:35 AM, Dumitru Potop-Butucaru< >> dumitru.potop_butucaru@inria.fr> wrote: >> >> Hello, >>> >>> I'm certain most users here will consider the question trivially simple, >>> but I browsed the documentation without finding a solution. >>> >>> The question is quite general: Given a polymorphic definition like >>> Map.Make(X), where >>> X is some module, how can I specialize its 'a type parameter, e.g. by >>> setting it to Y, so that >>> I have maps from X to Y ? >>> >>> Yours, >>> Jacky Potop >>> >>> _______________________________________________ >>> Caml-list mailing list. Subscription management: >>> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list >>> Archives: http://caml.inria.fr >>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >>> Bug reports: http://caml.inria.fr/bin/caml-bugs >>> >>> >>> > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > > --0016e6d77e7bc755370490b4493b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Why do you want to do this? What benefit does it bring that cannot be achie= ved by leaving the polymorphic type?

On M= on, Sep 20, 2010 at 1:25 PM, Dumitru Potop-Butucaru <<= a href=3D"mailto:dumitru.potop_butucaru@inria.fr">dumitru.potop_butucaru@in= ria.fr> wrote:

Actually, I was looking for a way to specialize a whole module,
not just the associated type (**this** I knew how to do).
I would like to write something like:

=A0 =A0include module type of Set.Make(String) with 'a=3D int

Is this possible?

Yours,
Jacky Potop





On 20/09/2010 16:57, Ashish Agarwal wrote:
module M =3D Map.Make(String)

type t =3D int M.t

Type t is the type of maps from string's to int's. Or alternatively= write a
function that assumes 'a is some specific type:

# let f m =3D M.fold (fun _ x y -> =A0x + y) m 0;;
val f : int M.t -> =A0int =3D<fun>


On Mon, Sep 20, 2010 at 10:35 AM, Dumitru Potop-Butucaru<
dumitr= u.potop_butucaru@inria.fr> =A0wrote:

Hello,

I'm certain most users here will consider the question trivially simple= ,
but I browsed the documentation without finding a solution.

The question is quite general: Given a polymorphic definition like
Map.Make(X), where
X is some module, how can I specialize its 'a type parameter, e.g. by setting it to Y, so that
I have maps from X to Y ?

Yours,
Jacky Potop

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.in= ria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs




_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.in= ria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


--0016e6d77e7bc755370490b4493b--