[Haskell-cafe] Simple but interesting (for me) problem

Alex Queiroz asandroq at gmail.com
Wed Oct 21 14:31:45 EDT 2009


Hallo,

On 10/21/09, Tim Wawrzynczak <inforichland at gmail.com> wrote:
> Here's an example in the IO monad:
>
> import Data.IORef
> import System.IO.Unsafe
>
> counter = unsafePerformIO $ newIORef 0
>
> next = do
>   modifyIORef counter (+1)
>   readIORef counter
>
> Naturally, this uses unsafePerformIO, which as you know, is not kosher...
>

     This is different because counter is global.

Cheers,
-- 
-alex
http://www.ventonegro.org/


More information about the Haskell-Cafe mailing list