[Haskell-beginners] Just how unsafe is unsafe
Austin Seipp
mad.one at gmail.com
Sun Feb 8 02:45:45 EST 2009
Excerpts from Andrew Wagner's message of Thu Feb 05 15:11:17 -0600 2009:
> My question is, to what extent is this true?
You can completely destroy the soundness of the type system:
import Data.IORef
import System.IO.Unsafe
import Control.Monad
cast :: a -> b
cast x = f where
f = unsafePerformIO $ do
writeIORef r [x]
b <- liftM head $ readIORef r
return b
Austin
More information about the Beginners
mailing list