From: Remi VANICAT <vanicat@labri.u-bordeaux.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Re: [Q]: Co(ntra)variance and subtyping?
Date: 19 Nov 2001 10:54:02 +0100 [thread overview]
Message-ID: <ya3d72f84sl.dlv@serveur4.labri.fr> (raw)
In-Reply-To: <Pine.GSO.4.33.0111181304140.27347-100000@clipper.ens.fr>
Alain Frisch <frisch@clipper.ens.fr> writes:
> Now, if you don't have the definition of a type constructor - say
> it is an abstract type from your point of view -
> you can't tell what its variance is w.r.t one of its arguments.
> So OCaml allows to specify this information in module interface;
> for instance, in map.mli:
>
> module type S =
> sig
> type key
> (* The type of the map keys. *)
> type (+'a) t
> (* The type of maps from type [key] to type ['a]. *)
> ...
>
>
> The '+' means that type t is covariant: a map from type key to type
> t1 can be coerced to a map from type key to type t2 if and only
> if t1 is a subtype of t2.
>
> (I don't know why other modules such as Queue do not give variance
> information ...)
because Queue are neither covariant nor contravariant :
- a Queue contain things, so it can't be contravariant,
- you can add things to queue, so it can't be covariant
infact, most of the mutable thing are neither contravariant nor
covariant.
--
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-11-19 9:54 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-16 19:37 [Caml-list] " Clemens Hintze
2001-11-17 14:18 ` Mark Wotton
2001-11-17 14:55 ` Mark Wotton
2001-11-17 17:50 ` [Caml-list] " Clemens Hintze
2001-11-17 23:17 ` Mark Wotton
2001-11-18 9:16 ` Clemens Hintze
2001-11-18 13:18 ` Alain Frisch
2001-11-19 9:54 ` Remi VANICAT [this message]
[not found] ` <9t7v4d$gij$1@qrnik.zagroda>
2001-11-18 11:57 ` Marcin 'Qrczak' Kowalczyk
2001-11-18 13:34 ` [Caml-list] " Andreas Rossberg
2001-11-18 21:22 ` Pixel
2001-11-19 0:33 ` Jacques Garrigue
2001-11-18 22:35 ` David Gurr
2001-11-19 7:24 ` [Caml-list] " Clemens Hintze
2001-11-19 12:03 ` Markus Mottl
2001-11-19 8:29 ` [Caml-list] " Xavier Leroy
2001-11-19 11:03 ` Alain Frisch
2001-11-20 9:58 ` Didier Remy
2001-11-19 11:14 ` Pixel
2001-11-18 22:30 ` [Caml-list] Re: variance, subtyping and monads... oh, my! james woodyatt
2001-11-19 8:11 ` Francois Pottier
2001-11-19 9:02 ` james woodyatt
2001-11-19 9:58 ` Markus Mottl
2001-11-19 20:47 ` james woodyatt
2001-11-19 12:56 ` Frank Atanassow
2001-11-19 10:39 ` Andreas Rossberg
2001-11-19 12:21 ` Markus Mottl
2001-11-19 13:43 ` [Caml-list] Kylix and OCaml Christophe Raffalli
2001-11-20 2:05 ` Vitaly Lugovsky
2001-11-20 8:51 ` Christophe Raffalli
2001-11-22 1:42 ` Vitaly Lugovsky
2001-11-20 10:00 ` Benjamin Monate
2001-11-20 10:24 ` [Caml-list] [Bug in an interface between C++ and OCAML due to some pointer encapsulation] Sylvain Kerjean
2001-11-20 12:14 ` [Caml-list] Kylix and OCaml Maxence Guesdon
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=ya3d72f84sl.dlv@serveur4.labri.fr \
--to=vanicat@labri.u-bordeaux.fr \
--cc=caml-list@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