Matthew Brecknell <haskell <at> brecknell.org> writes:

> 
> 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.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to