-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Oct 27, 2008, at 7:25 PM, Rodney D Price wrote:
Perhaps my mental picture is a little less flawed,
now, but this brings up something about the IO
monad that has always bothered me. Papers on the
IO monad say things like "A term of type IO ()
den
>> iio :: IO (IORef Int)
>> iio = newIORef 0
I sometimes feel like "IO" should be renamed to
"CommandSequenceReturning". So the above would read:
iio :: CommandSequenceReturning (IORef Int)
iio = newIORef 0
I.e. iio is not an IORef Int but only a (trivial) sequence of commands
that will end
> Rodney D Price wrote:
>
> Okay... However, when I use IO in a Haskell program,
> the response is usually pretty snappy. It's not as
> if the Haskell runtime is hanging around, waiting for
> some time in the future when it might be appropriate
> to do IO. It happens right now. Yet the literatur
On 2008 Oct 27, at 20:25, Rodney D Price wrote:
Okay... However, when I use IO in a Haskell program,
the response is usually pretty snappy. It's not as
if the Haskell runtime is hanging around, waiting for
some time in the future when it might be appropriate
to do IO. It happens right now. Yet
Thanks for all the replies.
Perhaps my mental picture is a little less flawed,
now, but this brings up something about the IO
monad that has always bothered me. Papers on the
IO monad say things like "A term of type IO ()
denotes an action, but does not necessarily perform
the action." (Wadler,
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" acting just like a C
> #define macro: every time I call "iio", I'm really
> just writing "newIORef 0". Is
Rodney D Price wrote:
every time I call "iio", I'm really
just writing "newIORef 0". Is that what you're saying?
Yes. :-)
M.
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell
On Mon, 2008-10-27 at 17:02 -0600, Rodney D Price wrote:
> My old, deeply flawed mental picture had "iio" taking
> the role of a pointer to a value.
Not so much flawed: you just need to realize that Haskell considers the
sub-program `create a new IORef with contents 0 and return it' to be a
perfec
On 2008 Oct 27, at 19:02, 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" acting just like a C
#define macro: every time I call "iio", I'm really
just writing "newIORef 0". Is that what y
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" acting just like a C
#define macro: every time I call "iio", I'm really
just writing "newIORef 0". Is that what you're saying?
-Rod
On Oct 27, 2008, at 4:36 P
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
Rodney D Price wrote:
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
12 matches
Mail list logo