caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: Alain Frisch <alain.frisch@lexifi.com>
Cc: caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] What is an applicative functor?
Date: Fri, 8 Apr 2011 19:09:25 +0900	[thread overview]
Message-ID: <1C0CF1AD-3AF4-409F-9367-A9FBA8716CD1@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <4D9ECAF2.7070300@lexifi.com>

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

  reply	other threads:[~2011-04-08 10:09 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 [this message]
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
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=1C0CF1AD-3AF4-409F-9367-A9FBA8716CD1@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=alain.frisch@lexifi.com \
    --cc=caml-list@yquem.inria.fr \
    /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).