[Haskell-cafe] why cannot i get the value of a IORef variable ?
zaxis
z_axis at 163.com
Thu Oct 22 01:37:36 EDT 2009
thank you! In fact i really donot understand "unsafePerformIO" very much !
Thomas DuBuisson wrote:
>
> 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
>>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
--
View this message in context: http://www.nabble.com/why-cannot-i-get-the-value-of-a-IORef-variable---tp26004111p26004340.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe
mailing list