Yes, it works now! thank you very much!
Kyle Murphy-2 wrote: > > I assume you're trying this at the GHCi prompt, which is where you're > problem is coming from, specifically on the first line. > When you do: >> let aaa = unsafePerformIO $ newIORef [] > GHCi takes a wild stab at the type of [] and comes up with the type [()], > so > now you have a IORef [()] type, which is why when you try > to store [1,2,3] in the IORef you get back [(),(),()]. Try this instead > and > it should work: >> let aaa = unsafePerformIO $ newIORef ([] :: [Int]) > > -R. Kyle Murphy > -- > Curiosity was framed, Ignorance killed the cat. > > > On Thu, Oct 22, 2009 at 01:02, zaxis <z_a...@163.com> wrote: > >> >> > let aaa = unsafePerformIO $ newIORef [] >> > writeIORef aaa [1,2,3] >> > readIORef aaa >> [(),(),()] >> >> 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 > > -- View this message in context: http://www.nabble.com/why-cannot-i-get-the-value-of-a-IORef-variable---tp26004111p26004260.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