Hello Rodney,

Tuesday, October 28, 2008, 1:27:26 AM, you wrote:

> Now I define an IORef and a couple of counters that share
> the IORef,

>> iio :: IO (IORef Int)
>> iio = newIORef 0
>> ic1 = do { io <- iio ; count io 0 }
>> ic2 = do { io <- iio ; count io 0 }


> So apparently my mental picture of an IORef as a pointer
> to a value is wrong.  I need a new mental picture.  What's
> going on here?

this part is right. but "iio = newIORef 0" doesn't define IORef,
instead it defines *operation* that creates new IORef and returns it

then ic1 and ic2 are *operations* that performs iio, creating new IORef
on each call, and then use this new IORef in further operation

look at http://haskell.org/haskellwiki/IO_inside


-- 
Best regards,
 Bulat                            mailto:[EMAIL PROTECTED]

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to