Am Freitag, 1. Dezember 2006 21:37 schrieb Krasimir Angelov:
> [...]
> do allocConsole
>      .....
>      .....
>      putStrLn "Hello, world!"
>      .....
>      .....
>      freeConsole
> [...]

Having explicit alloc/free pairs can lead to resource leaks in the presence of 
exceptions. Simple solution: Merge both parts into a single function, using 
"bracket" or friends internally:

   withConsole $ do
      ...
      putStrLn "I'm exception safe! :-)"
      ...

Cheers,
   S.
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to