
10 Nov
2008
10 Nov
'08
5:09 p.m.
Ryan Ingram schrieb:
There's a natural relation between higher rank types and existentials; one way to think about it is this: if you have some existential type t (subject to some constraints), you cannot operate on it except with some function that accepts any type t subject to those constraints.
There is a simple encoding of existential types using higher rank types:
Given
data E a1..an = forall e1...en. (constraints) => E t1..tn where t1..tn are types in terms of a1..an, we replace with data E' a1..an = E' (forall b. (forall e1..en. t1 -> t2 -> ... -> tn -> b) -> b)
Can you please put this on the Wiki?