2 Dec
2006
2 Dec
'06
5:08 p.m.
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.