From: Markus Mottl <markus@oefai.at>
To: John Max Skaller <skaller@ozemail.com.au>
Cc: Michal Moskal <malekith@pld-linux.org>, caml-list@inria.fr
Subject: Re: [Caml-list] First order compile time functorial polymorphism in Ocaml
Date: Mon, 23 Jun 2003 12:08:42 +0200 [thread overview]
Message-ID: <20030623100842.GA3386@fichte.ai.univie.ac.at> (raw)
In-Reply-To: <3EF6796E.20004@ozemail.com.au>
On Mon, 23 Jun 2003, John Max Skaller wrote:
> >For example consider:
> >
> >type 'a t = Foo 'a -> unit
> >
> >To map : 'a t -> 'b t here, you need f : 'b -> 'a.
>
> Ah, ok, exponential is contravariant.
This problem (generalizing fold/unfold to exponentials that use
the type constructor also in contravariant positions) is solved by
applying a solution for modelling recursive datatypes as fixed points
of difunctors. See the following very nice paper for details:
Title: Bananas in space: extending fold and unfold to exponential types
Authors: Erik Meijer and Graham Hutton
What you need in your example is a cofunctor "f" together with a function
"comap", which takes the functional (a -> b) to (f b -> f a).
In the mixed case (co- and contravariant occurrences in the same type
definition) you need difunctors (see paper for details).
Regards,
Markus Mottl
--
Markus Mottl http://www.oefai.at/~markus markus@oefai.at
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2003-06-23 10:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-22 18:25 John Skaller
2003-06-22 19:03 ` Michal Moskal
2003-06-23 3:52 ` John Max Skaller
2003-06-23 9:58 ` Michal Moskal
2003-06-23 10:27 ` Markus Mottl
2003-06-23 10:35 ` Michal Moskal
2003-06-23 10:08 ` Markus Mottl [this message]
2003-06-23 8:07 ` Francois Rouaix
2003-06-23 9:03 ` Roberto Di Cosmo
2003-06-23 17:37 ` John Max Skaller
2003-06-23 9:03 ` Jun.Furuse
2003-06-23 17:53 ` John Max Skaller
2003-06-23 18:02 ` Jacques Carette
2003-06-24 1:00 ` Jacques Garrigue
2003-06-24 12:45 ` John Max Skaller
2003-06-24 14:34 ` Jacques Carette
2003-06-24 23:45 ` Jacques Garrigue
2003-06-25 2:27 ` John Max Skaller
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=20030623100842.GA3386@fichte.ai.univie.ac.at \
--to=markus@oefai.at \
--cc=caml-list@inria.fr \
--cc=malekith@pld-linux.org \
--cc=skaller@ozemail.com.au \
/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