[Haskell] Re: Rank-N types vs existential types

Andre Pang ozone at algorithm.com.au
Wed Apr 27 07:56:00 EDT 2005

On 27/04/2005, at 9:35 PM, Andreas Rossberg wrote:

> The difference really shows up when you *use* (deconstruct) them:
>   g (RankNEq f) = (f 4 5, f True False)
> This allows the embedded function to be used polymorphically. But:
>   h (ExistsEq f) = ???
> Here, you cannot use f at all (well, except with undefined). The type 
> is not polymorphic in "a" on the RHS, it is abstract! You'd need to 
> encapsulate a value of the same type (or a constructing function) as 
> well to this type useful.

Ah, OK!  That's quite enlightening.  Thanks Andreas, Krasimir, and 
Tomasz for all your replies.

% Andre Pang : trust.in.love.to.save  <http://www.algorithm.com.au/>

More information about the Haskell mailing list