[Haskell] Real life examples

George Russell ger at informatik.uni-bremen.de
Thu Nov 25 04:19:36 EST 2004

Lennart wrote (snipped):
 > An "easy" way to
 > prove it is to provide an equivalent implementation that uses only
 > pure functions.  As far as I remember Control.Monad.ST can be written
 > purely.  And I think the same is true for Data.Dynamic.

I don't see how it can be, since you can use Data.Dynamic to provide an
unsafe function
    cast : a -> b

newtype UnsafeCast a = UnsafeCast a

instance Typeable (UnsafeCast a) where
    typeOf _ = mkAppTy (mkTyCon "") []

cast :: a -> b
cast a =
       Just (UnsafeCast b) = fromDynamic (toDyn (UnsafeCast a))

More information about the Haskell mailing list