Hi

>   showsType io = showString "(IO " . showsType a . showChar ')'
>        where
>        a = unsafePerformIO io

You don't even need unsafePerformIO! All you need is a proxy a which
has the right type, this can be done by doing:

showsType io = showString "(IO " . showsType a . showChar ')'
     where
     a = undefined
     b = asTypeOf (return a) io

i.e. instead of unwrapping the io, you wrap up the a, and demand it
has the same type as io. Same result, but now entirely "safe".

[Note: entirely untested, but the idea should be sound]

Thanks

Neil
_______________________________________________
Yhc mailing list
Yhc@haskell.org
http://www.haskell.org/mailman/listinfo/yhc

Reply via email to