[Haskell-cafe] why cannot i get the value of a IORef variable ?
orclev at gmail.com
Thu Oct 22 01:19:22 EDT 2009
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_axis at 163.com> wrote:
> > let aaa = unsafePerformIO $ newIORef 
> > writeIORef aaa [1,2,3]
> > readIORef aaa
> View this message in context:
> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe