I assume you&#39;re trying this at the GHCi prompt, which is where you&#39;re problem is coming from, specifically on the first line.<br>When you do:<br>&gt; let aaa = unsafePerformIO $ newIORef []<br>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<br>
to store [1,2,3] in the IORef you get back [(),(),()]. Try this instead and it should work:<br>&gt; let aaa = unsafePerformIO $ newIORef ([] :: [Int])<br><br clear="all">-R. Kyle Murphy<br>--<br>Curiosity was framed, Ignorance killed the cat.<br>

<br><br><div class="gmail_quote">On Thu, Oct 22, 2009 at 01:02, zaxis <span dir="ltr">&lt;<a href="mailto:z_axis@163.com">z_axis@163.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
&gt; let aaa = unsafePerformIO  $ newIORef []<br>
&gt; writeIORef aaa [1,2,3]<br>
&gt; readIORef aaa<br>
[(),(),()]<br>
<br>
sincerely!<br>
<font color="#888888">--<br>
View this message in context: <a href="http://www.nabble.com/why-cannot-i-get-the-value-of-a-IORef-variable---tp26004111p26004111.html" target="_blank">http://www.nabble.com/why-cannot-i-get-the-value-of-a-IORef-variable---tp26004111p26004111.html</a><br>

Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</font></blockquote></div><br>