, , Haskell. <- do-notation. result <- f handle " f handle result"; " result " " f handle" ( "" - , Monad, , IO ).
.. Monad <- m a a , , result <- f handle f result :: IO a, result :: a return result :: IO a.
PS- let ( in !), <-. :
withFile' :: FilePath -> IOMode -> (Handle -> IO a) -> IO a
withFile' path mode f = do
handle <- openFile path mode
let result = f handle
hClose handle
result
, let , result IO a.