From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: Dawid Toton <d0@wp.pl>
Cc: caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] What is an applicative functor?
Date: Thu, 07 Apr 2011 23:49:50 +0200 [thread overview]
Message-ID: <1302212990.8429.1150.camel@thinkpad> (raw)
In-Reply-To: <4D9E28D2.1050808@wp.pl>
Am Donnerstag, den 07.04.2011, 23:12 +0200 schrieb Dawid Toton:
> What does it mean that a functor is applicative?
Roughly: If you apply a functor twice with the same input modules, the
opaque types in the output remain compatible. For instance:
module S1 = Set.Make(String)
module S2 = Set.Make(String)
Now, S1.t and S2.t are type-compatible, although this type is opaque.
(E.g. you can do S1.empty = S2.empty.)
Compare this with:
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:
# M1.Variant = M2.Variant;;
Error: This expression has type M2.t but an expression was expected of
type M1.t
Gerd
> Is there any analogy between applicative functors in OCaml and the
> Applicative type class of Haskell?
> Dawid
>
--
------------------------------------------------------------
Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany
gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de
Phone: +49-6151-153855 Fax: +49-6151-997714
------------------------------------------------------------
next prev parent reply other threads:[~2011-04-07 21:49 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 [this message]
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
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=1302212990.8429.1150.camel@thinkpad \
--to=info@gerd-stolpmann.de \
--cc=caml-list@yquem.inria.fr \
--cc=d0@wp.pl \
/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