caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ivan Gotovchits <ivg@ieee.org>
To: Gabriel Scherer <gabriel.scherer@gmail.com>
Cc: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>,  caml-list@inria.fr
Subject: Re: [Caml-list] phantom types and identity function
Date: Wed, 28 Nov 2012 07:42:33 +0400	[thread overview]
Message-ID: <87fw3uxuja.fsf@golf.niidar.ru> (raw)
In-Reply-To: <CAPFanBFbY8drGNzwy8y6jOaFe=6oSs26PjtcWFMuntcTv8+eCQ@mail.gmail.com> (Gabriel Scherer's message of "Tue, 27 Nov 2012 16:59:43 +0100")

Gabriel Scherer <gabriel.scherer@gmail.com> writes:

> The absence of such a variance marker means that some OCaml code is
> hard to abstract through a module boundary: in presence of the
> explicit definition, the type-checker will accept to subtype between
> any instances of the type (by simple expansion), but if you abstract
> over its definition you cannot express this property anymore. Your
> workaround corresponds to statically expressing this irrelevance
> through an exported equation, but there are (arguably somewhat
> unnatural) scenarios where this isn't convenient.

And now I'm confused much more =). Please, could you explain the
relevance between subtyping and type restriction?

When I try to restrict type [t -> t'] by the some type [r -> r'] does
the compiler checks that [r -> r'] is a subtype of [t -> t']? And even
if it does, in my example 
   [`A] t -> [`B] t

[[`A]] is clearly not a subtype of [[`B]] (and vice versa). So I do not
see how an explicit variance specification can help.


-- 
         (__) 
         (oo) 
   /------\/ 
  / |    ||   
 *  /\---/\ 
    ~~   ~~   
...."Have you mooed today?"...

  reply	other threads:[~2012-11-28  3:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27 11:00 Ivan Gotovchits
2012-11-27 14:08 ` Jacques Garrigue
2012-11-27 15:59   ` Gabriel Scherer
2012-11-28  3:42     ` Ivan Gotovchits [this message]
2012-11-28  8:12       ` Gabriel Scherer
2012-11-28 10:32         ` Ivan Gotovchits
2012-11-28  3:29   ` Ivan Gotovchits

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=87fw3uxuja.fsf@golf.niidar.ru \
    --to=ivg@ieee.org \
    --cc=caml-list@inria.fr \
    --cc=gabriel.scherer@gmail.com \
    --cc=garrigue@math.nagoya-u.ac.jp \
    /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).