X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FIO.hs;fp=System%2FIO.hs;h=5304d8389892b0df01f84d02b59fa81cd2e0476f;hb=d9dadf282bfdc7f848a8e7384a60f460aa51f93c;hp=0a65c73bb1cdeaf53667653c27501137b15cba0e;hpb=05b8044427ea127ad4d7783162dbb28f81e4c6dd;p=ghc-base.git diff --git a/System/IO.hs b/System/IO.hs index 0a65c73..5304d83 100644 --- a/System/IO.hs +++ b/System/IO.hs @@ -449,7 +449,9 @@ hPrint hdl = hPutStrLn hdl . show -- | @'withFile' name mode act@ opens a file using 'openFile' and passes -- the resulting handle to the computation @act@. The handle will be -- closed on exit from 'withFile', whether by normal termination or by --- raising an exception. +-- raising an exception. If closing the handle raises an exception, then +-- this exception will be raised by 'withFile' rather than any exception +-- raised by 'act'. withFile :: FilePath -> IOMode -> (Handle -> IO r) -> IO r withFile name mode = bracket (openFile name mode) hClose