zaxis <z_a...@163.com> wrote:
>> let aaa = unsafePerformIO  $ newIORef []
>> writeIORef aaa [1,2,3]
>> readIORef aaa
> [(),(),()]

What in Haskells name do you think you're doing?  Don't use
unsafePerformIO like that!  Its unnecessary and a bit concerning,
really.

Prelude> :m Data.IORef
Prelude Data.IORef> x <- newIORef [] :: IO (IORef [Int])
Prelude Data.IORef> writeIORef x [1,2,3]
Prelude Data.IORef> readIORef x
[1,2,3]


>
> sincerely!
> --
> View this message in context: 
> http://www.nabble.com/why-cannot-i-get-the-value-of-a-IORef-variable---tp26004111p26004111.html
> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to