
7 Sep
2007
7 Sep
'07
7:15 a.m.
Matthew Brecknell
Levi Stephen:
I have a data type:
data T a = forall b. (Show b) => T b a
and I want to use/extract 'b' from this.
You can't. (Well, I believe you can if you have prior knowledge of the actual type of the existentially wrapped "b", and you're willing to use an "unsafe" coerce, but I've never tried.)
You can do type safe casts. IIRC Stephanie Weirich presented a paper on it at icfp 2000(?). Of course, as you point out, you would still need prior knowledge of the type.