From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p388Kfoh007476 for ; Fri, 8 Apr 2011 10:20:41 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuQBAB/Enk3RVda0kGdsb2JhbACmCggUAQEBAQkJDQcUBCGIepwBjQuFB4kOAQEDBoVnBIVTh3uEZYRROoEi X-IronPort-AV: E=Sophos;i="4.63,322,1299452400"; d="scan'208";a="96548012" Received: from mail-iw0-f180.google.com ([209.85.214.180]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 08 Apr 2011 10:20:35 +0200 Received: by iwn6 with SMTP id 6so4593729iwn.39 for ; Fri, 08 Apr 2011 01:20:34 -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=eWo1oB4lxjxIRURj0KMKpF+kiDu+Lg9AtuD+vfQtYV8=; b=Ik6LODmcBpPatzyQF9rjhRyXd7/st2BK1N0lkrDyoglAtU7zKae6Fez4LqRY67DZOI GFkz8Bix1C7YV2fhBCvJBeqpSYKoo+gDWAah3TVjmdY7DRPm92Sc0Cu7T3UguDC+pPZw 8VocsXlvQIDjcqg5GtAKBBXZts043WJstDth4= 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=n8zG8wgcf7iuGoZ5RVLebJlZYrjG+GeMqMWpoLe0iABHxQ05w6pmDF0m+TLEZ5FTDO br6Z6HcpMG9QMrWuvzJDed+h2VmHrYk6dbEYvL0j4we81tdCYtsipScM1/phkIRFcIDL 2vP3TmUo+wvggTYi9YFY+E14xMyRGX/bZPgC0= Received: by 10.42.152.71 with SMTP id h7mr3054603icw.440.1302250833943; Fri, 08 Apr 2011 01:20:33 -0700 (PDT) Received: from tet.garrigue.jp (58x158x128x157.ap58.ftth.ucom.ne.jp [58.158.128.157]) by mx.google.com with ESMTPS id t1sm673834ibm.21.2011.04.08.01.20.32 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 08 Apr 2011 01:20:33 -0700 (PDT) Sender: Jacques Garrigue Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=iso-8859-1 From: Jacques Garrigue In-Reply-To: <4D9EC172.1060205@lexifi.com> Date: Fri, 8 Apr 2011 17:20:30 +0900 Cc: caml-list Message-Id: References: <4D9E28D2.1050808@wp.pl> <1302212990.8429.1150.camel@thinkpad> <0F248A34-05CF-4640-B122-75C4CE7C2CD2@mpi-sws.org> <4D9EC172.1060205@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 p388Kfoh007476 Subject: Re: [Caml-list] What is an applicative functor? On 2011/04/08, at 17:04, Alain Frisch wrote: > On 04/08/2011 08:50 AM, Andreas Rossberg wrote: >> Nitpick: the Make functor is still applicative. All functors in OCaml >> are applicative. > > NitpickČ: except if you compile with -no-app-funct. > >> Aside: In general, you really want to have both: functors with impure >> bodies better be generative, while functors with pure bodies should be >> applicative. > > I'm not sure the benefits of applicative functors are worth the extra complexity they induce, especially if you want to support applicative functors in the same system as well. As far as I understand, applicative functors are useful primarily to give precise types to higher-order functors (which are rare enough). > > It would be interested to see how much effort would be needed to adapt large code bases to compile with -no-app-funct (it probably amounts to giving a name to the result of a few functor applications). 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. Jacques Garrigue