I'm trying to understand how an IORef (MVar, TVar) might be
shared between separate instances of function closures.
I've defined a function `count` that returns a function with
an IORef "inside",
count :: IORef Int -> Int -> IO (Char -> IO Int)
count io i = do
writeIORef io i
return (\c -> i
're saying?
-Rod
On Oct 27, 2008, at 4:36 PM, Martijn van Steenbergen wrote:
Rodney D Price wrote:
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?
Naming the creation of a new IORef "iio&
, or is it actual, literal fact?
-Rod
On Oct 27, 2008, at 5:43 PM, Timothy Goddard wrote:
On Tue, 28 Oct 2008 12:02:54 Rodney D Price wrote:
My old, deeply flawed mental picture had "iio" taking
the role of a pointer to a value. My bright, shiny
new mental picture has "iio&qu
I've gotten this sort of error several times, which mysteriously
disappears
when I add more functions to the code:
storeError.hs:13:38:
Couldn't match expected type `a' (a rigid variable)
against inferred type `String'
`a' is bound by the type signature for `throwError'