
(CCing the list as this is of general concern.)
On 01/02/07, Yitzchak Gale
Why is this unsafe? What could go wrong?
It could segfault due to the type safety properties that unsafePerformIO breaks: import System.IO.Unsafe import Data.IORef ref :: IORef [a] ref <- newIORef [] main = do writeIORef ref [42] val <- readIORef ref print (val :: [Char]) If you use the pragma you're forced to import unsafePerformIO and hopefully check the haddock docs [1] where this issue is listed. [1]: http://haskell.org/ghc/docs/latest/html/libraries/base/System-IO-Unsafe.html -- -David House, dmhouse@gmail.com

Hello David, Friday, February 2, 2007, 12:14:05 AM, you wrote:
Why is this unsafe? What could go wrong?
ref :: IORef [a] ref <- newIORef []
it could be easily fixed by disallowing polymorphic types here. if someone really need polymorphism, he can continue to use old trick -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
participants (2)
-
Bulat Ziganshin
-
David House