caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Till Varoquaux <till@pps.jussieu.fr>
To: Andreas Rossberg <rossberg@mpi-sws.org>
Cc: Gerd Stolpmann <info@gerd-stolpmann.de>, Dawid Toton <d0@wp.pl>,
	caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] What is an applicative functor?
Date: Fri, 8 Apr 2011 12:43:12 -0400	[thread overview]
Message-ID: <BANLkTimDvuTwMS6OKbXQoftcXCPv0T8vNA@mail.gmail.com> (raw)
In-Reply-To: <0F248A34-05CF-4640-B122-75C4CE7C2CD2@mpi-sws.org>

On Fri, Apr 8, 2011 at 2:50 AM, Andreas Rossberg <rossberg@mpi-sws.org> wrote:
> On Apr 7, 2011, at 23:49, Gerd Stolpmann wrote:
>>
>> module Make(X : sig end) = struct type t = Variant end
>> module M1 = Make(struct end)
>> module M2 = Make(struct end)
>>
>> Now, M1.t and M2.t are incompatible - for nominal types like variants
>> the functors aren't applicative, and each instance is a thing of its
>> own:
>
> Nitpick: the Make functor is still applicative. All functors in OCaml are
> applicative. The fact that you get different results above is caused by the
> way you apply the functor, not by the way it is defined.
>
> "Applicative" distinguishes functor semantics in OCaml from that in SML,
> where functors are "generative", i.e. you always get new types when you
> apply them.
>
> Aside: In general, you really want to have both: functors with impure bodies
> better be generative, while functors with pure bodies should be applicative.
> The absence of generative functors in OCaml also is the reason that you
> cannot unpack a first-class module in a functor body (non-locally), because
> that is unsound with applicative semantics.
>
> /Andreas
I tend to consider using Impure functors as very poor coding hygiene..
I am sure there are compelling use cases but I've yet to come across
one. Providing safer types for impure functors does not seem
compelling enough to justify having several kind of functors.
I am not really sure I want applicative functors (based upon my
experience they are pretty hard to explain and rarely buy me anything)
but I balk at the idea of having both applicative and generative
functors..

Till

>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>


  parent reply	other threads:[~2011-04-08 16:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-07 21:12 Dawid Toton
2011-04-07 21:49 ` Gerd Stolpmann
2011-04-08  0:44   ` [Caml-list] " Dawid Toton
2011-04-08  1:34     ` Gerd Stolpmann
2011-04-08  6:50   ` [Caml-list] " Andreas Rossberg
2011-04-08  8:04     ` Alain Frisch
2011-04-08  8:20       ` Jacques Garrigue
2011-04-08  8:38         ` Jacques Garrigue
2011-04-08  8:44         ` Alain Frisch
2011-04-08 10:09           ` Jacques Garrigue
2011-04-08 11:25           ` Julien Signoles
2011-04-08 11:58             ` Alain Frisch
2011-04-11  7:10               ` Julien Signoles
2011-04-11  7:21                 ` Julien Signoles
2011-04-08 13:43           ` rossberg
2011-04-08 16:26             ` Julien Signoles
2011-04-13  2:36             ` Lucas Dixon
2011-04-13  7:23               ` Andreas Rossberg
2011-04-15  3:08                 ` Lucas Dixon
2011-04-19 14:04                   ` Andreas Rossberg
2011-04-08 16:43     ` Till Varoquaux [this message]
2011-04-08 17:35       ` Alain Frisch
2011-04-08 18:44       ` Andreas Rossberg
2011-04-08 21:23     ` Lauri Alanko
2011-04-08 21:34       ` Guillaume Yziquel
2011-04-09 11:41       ` Andreas Rossberg
2011-04-08  5:35 ` Stefan Holdermans

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=BANLkTimDvuTwMS6OKbXQoftcXCPv0T8vNA@mail.gmail.com \
    --to=till@pps.jussieu.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=d0@wp.pl \
    --cc=info@gerd-stolpmann.de \
    --cc=rossberg@mpi-sws.org \
    /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).