Version française
Home     About     Download     Resources     Contact us    
Browse thread
wrapping parameterized types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andrej Bauer <Andrej.Bauer@f...>
Subject: Re: [Caml-list] wrapping parameterized types
rossberg@ps.uni-sb.de wrote:
> "skaller" <skaller@users.sourceforge.net> wrote:
>> On Thu, 2007-05-03 at 19:16 -0400, Chris King wrote:
>>> The solution is to use existential types.  In a record, you can tell
>>> O'Caml that a particular function _must_ be polymorphic:
>>>
>>> type 'b mylistfun = { listfun: 'a. 'a list -> 'b }
>> I'm still confused why this is called an existential, when
>> clearly the quantification is universal.
> 
> You have reason to be confused, because this is no existential type.
> 
> Dirk Thierbach:
>> It's because the universal quantifier is in a "negative" position,
>> which is equivalent to an existential quantifier on the outside.
>> Just pretend they are logic formulae instead of types, and then
>>
>> (\forall a. a) -> b   is equivalent to   \exists a. (a -> b)
> 
> Actually, no, these are not equivalent. Only the following are:
> 
> (\exists a. a) -> b   is equivalent to   \forall a. (a -> b)

Right, and this is in accordance with the terminology. Note that Dirk
misread the precedence of operators: in ocaml

  'a . 'a list -> 'b

means

  'a . ('a list -> 'b)

and not ('a . 'a list) -> 'b. So everything is fine. I do agree with
skaller that it is a bit perverse to call a quantifier "existential"
when it is obviously the universal quantifier, even if it is equivalent
to a formula containing an existential.

Andrej