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 p388ctHm008268 for ; Fri, 8 Apr 2011 10:38:55 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuQBANTInk3RVda0kGdsb2JhbAAupVsIFAEBAQEJCQ0HFAQhiHqcLY0LhQSJDgEBAwaFZwSFU4d7hGWEUTqBIg X-IronPort-AV: E=Sophos;i="4.63,322,1299452400"; d="scan'208";a="96549679" 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:38:51 +0200 Received: by iwn6 with SMTP id 6so4608344iwn.39 for ; Fri, 08 Apr 2011 01:38:50 -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=DK4ds1X/NkFNgs7n/hUQ/8HOMl79wDba2nggvCnx2DI=; b=cwEYNC33jP9Atoi+DP3vqT2qQN3ePTl2nHNawviv5GocVhg0SWhIsc8rPwGpvrZ6oQ a9aoL8xyosF4ZtN80URzJl+RsDalb9DcHubtpFh6c9QaTb4zv0w5RDfiE8joryyDKXRM KugHiaMeH/uNXIJpo2wizF3h70jPzF+NjwE2o= 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=PJV1IrFtHOxNSsjAFZcrYtlHtqHTGYBKvLt05iLvSw49U/L9fS/21ONN34zQ7rZ52c mDWKO96vZxdicX+VN9GFt6dLF9+YWTly1mJNC3O79rjd57Z93tccN605ng3qHkDD0td/ fNfZ/J8puq+L/C5Kl1Yp4VB9fXww7xQ05bTnU= Received: by 10.42.132.5 with SMTP id b5mr3130522ict.484.1302251928526; Fri, 08 Apr 2011 01:38:48 -0700 (PDT) Received: from tet.garrigue.jp (58x158x128x157.ap58.ftth.ucom.ne.jp [58.158.128.157]) by mx.google.com with ESMTPS id vw9sm1318252icb.23.2011.04.08.01.38.46 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 08 Apr 2011 01:38:47 -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: Date: Fri, 8 Apr 2011 17:38:44 +0900 Cc: caml-list Message-Id: <7A481AEF-CD44-4134-A755-044DB0F93679@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> 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 p388ctHm008268 Subject: Re: [Caml-list] What is an applicative functor? On 2011/04/08, at 17:20, Jacques Garrigue wrote: > On 2011/04/08, at 17:04, Alain Frisch wrote: >> 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. Another example of that is my conversion-based version of the expression problem. http://www.math.nagoya-u.ac.jp/~garrigue/papers/mixmod.ml.txt With -no-app-funct, most of the code is refused. Note that -no-app-funct not only refuses paths of the form F(X).t, but also F(X).S (i.e. a functor returning a signature). Actually, I wonder why it does refuse it syntactically, whereas potentially problematic signatures are very few. Jacques Garrigue