From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p38A9a4m013010 for ; Fri, 8 Apr 2011 12:09:37 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuQBAGLenk3RVda0kGdsb2JhbACmCggUAQEBAQkJDQcUBCGlVY0LhH2JDgEBAwaFZwSFU4d7hGWEUTqBIg X-IronPort-AV: E=Sophos;i="4.63,322,1299452400"; d="scan'208";a="92523187" Received: from mail-iw0-f180.google.com ([209.85.214.180]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 08 Apr 2011 12:09:31 +0200 Received: by iwn6 with SMTP id 6so4689744iwn.39 for ; Fri, 08 Apr 2011 03:09:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer; bh=TCV43IfdUj0HSvx2VAXD7na1SLF4YoMuZn0mKSp1Nzs=; b=HD41BzTudkDZQG2e9glurNnCGX7hPsZCQ6Z9huPtdS63gjz3i5g0ho+4WfFI3XtP/W Rb3w7aDWBXaYVU+m85LYYbrZPgD24HzQ5jDJzrUgwzZA4i7IX4WaAaxumgUNPHuBq309 6AgHA068vYBFgZnmsCS2363Gf/IuNw/rvgg3M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=xd6+FwuCSWac2DmwM981ciKl5DhNpQ4gVaupew4azd7ZYMmBnRHA0matOc2th+MoaK egdBe2AfGQvHUAG9NC8BzuTZuuSEEcVFXDmwAIhU+HgH4oHLqOdUt4Eo14x1C9wQR5Y8 NFlkDQxZNUH72KbFPGSgigWDnllLsC9bmBt/4= Received: by 10.43.56.73 with SMTP id wb9mr3474628icb.137.1302257369736; Fri, 08 Apr 2011 03:09:29 -0700 (PDT) Received: from tet.garrigue.jp (58x158x128x157.ap58.ftth.ucom.ne.jp [58.158.128.157]) by mx.google.com with ESMTPS id hc41sm1782629ibb.47.2011.04.08.03.09.27 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 08 Apr 2011 03:09:28 -0700 (PDT) Sender: Jacques Garrigue Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Jacques Garrigue In-Reply-To: <4D9ECAF2.7070300@lexifi.com> Date: Fri, 8 Apr 2011 19:09:25 +0900 Cc: caml-list Message-Id: <1C0CF1AD-3AF4-409F-9367-A9FBA8716CD1@math.nagoya-u.ac.jp> References: <4D9E28D2.1050808@wp.pl> <1302212990.8429.1150.camel@thinkpad> <0F248A34-05CF-4640-B122-75C4CE7C2CD2@mpi-sws.org> <4D9EC172.1060205@lexifi.com> <4D9ECAF2.7070300@lexifi.com> To: Alain Frisch X-Mailer: Apple Mail (2.1084) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p38A9a4m013010 Subject: Re: [Caml-list] What is an applicative functor? On 2011/04/08, at 17:44, Alain Frisch wrote: > On 04/08/2011 10:20 AM, Jacques Garrigue wrote: >> Applicative functors have other advantages, like the fact you can refer to a >> type produced by a functor without having really applied it. >> >> For instance think of the following functor definition >> >> module F(O : Set.OrderedType)(S : sig type t = Set.Make(O).t val union : t -> t -> t end) = ... >> >> If you want to do the same thing with generative functors, I believe you have to >> pass the result of Set.Make(O) around physically. >> I do think this is a significant weakness. > > I can imagine uses for: > > module F(O : Set.OrderedType)(S : Set.S with type elt = O.t) = > > but I don't see a real-life case where one would want functor F to know that the type S.t was really produced by applying Set.Make. Do you have a specific example in mind? Well, union was maybe not the right name for a new function, but imagine that you want sets with an extra operation. With generative functors, your have to have pass around the full implementation of sets. With applicative functors you just need to pass the extra operation, using the standard implementation of sets for other operations. I don't know whether this example is very useful. My other example using a functor returning a signature is maybe more important. To some extent one can do the same thing using destructive substitution, but before them there was no easy way to define signatures modularly using generative functors. Jacques Garrigue