[Haskell] IVars

Paul Johnson paul at cogito.org.uk
Fri Dec 7 14:01:09 EST 2007


Conal Elliott wrote:
> Oh.  Simple enough.  Thanks.
>
> Another question:  why the IO in readIVar :: IVar a -> IO a, instead 
> of just readIVar :: IVar a -> a?  After all, won't readIVar iv yield 
> the same result (eventually) every time it's called?
Because it won't necessarily yield the same result the next time you run 
it.  This is the same reason the stuff in System.Environment returns 
values in IO.

Paul.


More information about the Haskell mailing list