caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: rossberg@mpi-sws.org
To: "Dawid Toton" <d0@wp.pl>
Cc: rossberg@mpi-sws.org, "caml-list" <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Re: References and polymorphism
Date: Wed, 11 Jan 2012 16:34:26 +0100	[thread overview]
Message-ID: <0bfbfcb5fc4da2f9f021abc9da89aec5.squirrel@mail.mpi-sws.org> (raw)
In-Reply-To: <4F0D8FD6.1060605@wp.pl>

Dawid Toton wrote:
>>> The problem is that the 'a variable is bound by a general quantifier and
>>> at the same time it is used to give a type to the ref cell. But if this
>>> were forbidden, I see no need for the value restriction at all. For
>>> example:
>>>
>>> let g : forall 'a. 'a ->  'a =
>>>     fun (x : exists 'b. 'b) ->
>>>       let r : 'b option ref = ref None in
>>>       (* nothing bad can happen *)
>>>       ...
>> Nothing useful can happen either. You could never read a value back from r
>> and use/return it as an 'a or for anything else. So why would you want to
>> store it there in the first place?
>
> I can read from r and use it as 'b option. This is useful in general: a
> mutable store can be used locally to speed up computations. I can
> imagine working on 'b array to benefit from fast lookup.

But what do you do with that store? You can retrieve values from it, but
neither can use them locally (because they-re fully abstract) nor return
them (because they are not typed 'a). So it's useless to store them.

>> Also, I don't quite understand how your type annotations are supposed to
>> match up. If x : exists 'b. 'b, then f can't be forall 'a. 'a ->  'a.
> Use de Morgan's laws for quantifiers:
>
> (∃x. x) → y
>
> ¬((∃x. x) ∧ ¬y)
>
> ¬(∃x. (x ∧ ¬y))
>
> ∀x.(¬(x ∧ ¬y))
>
> ∀x.(x → y)
>
> I see, this is probably abuse of constructive logic in this case, but I
> believe the idea stays the same.

Yeah, I don't see how this is applicable here.

/Andreas


  reply	other threads:[~2012-01-11 15:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-10 15:29 [Caml-list] " Dario Teixeira
2012-01-10 15:45 ` Romain Bardou
2012-01-10 16:31   ` Arnaud Spiwack
2012-01-10 17:00 ` Dario Teixeira
2012-01-10 17:20   ` David Allsopp
2012-01-10 18:59     ` Gabriel Scherer
2012-01-11 10:48     ` [Caml-list] " Dawid Toton
2012-01-11 11:07       ` Gabriel Scherer
2012-01-11 13:00         ` Dawid Toton
2012-01-11 13:15           ` rossberg
2012-01-11 13:56             ` Dawid Toton
2012-01-11 15:42               ` rossberg
2012-01-12  9:55                 ` Dawid Toton
2012-01-12 10:05                   ` Andrej Bauer
2012-01-12 10:46                     ` Romain Bardou
2012-01-11 11:43       ` rossberg
2012-01-11 13:34         ` Dawid Toton
2012-01-11 15:34           ` rossberg [this message]
2012-01-11 13:57         ` Dawid Toton

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=0bfbfcb5fc4da2f9f021abc9da89aec5.squirrel@mail.mpi-sws.org \
    --to=rossberg@mpi-sws.org \
    --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;
as well as URLs for NNTP newsgroup(s).