[Haskell-cafe] A practical Haskell puzzle

wren ng thornton wren at freegeek.org
Mon Feb 28 12:34:30 CET 2011


On 2/28/11 6:01 AM, Yves Parès wrote:
>>   takeC :: Int ->  Compoz a b ->  (exists c. Compoz a c)
>>   dropC :: Int ->  Compoz a b ->  (exists c. Compoz c b)
>
> What does 'exists' means? To create a rank-2 type can't you use:
>
> takeC :: Int ->  Compoz a b ->  (forall c. Compoz a c)
>
> ??

For any A and T,

     foo :: A -> (forall b. T b)

is identical to

     foo :: forall b. (A -> T b)

More technically, they're isomorphic--- in System F or any other gritty 
language that makes you explicitly pass types around. Since Haskell 
handles type passing implicitly, the isomorphism looks like identity.

-- 
Live well,
~wren



More information about the Haskell-Cafe mailing list