[Haskell-cafe] why cannot i get the value of a IORef variable ?
Thomas DuBuisson
thomas.dubuisson at gmail.com
Thu Oct 22 01:25:27 EDT 2009
zaxis <z_axis at 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
More information about the Haskell-Cafe
mailing list