3
import Control.Exception (bracketOnError)
5
(openFile, IOMode(ReadMode), hClose, hFileSize, hGetContents)
7
-- | A variant of IO with an extra dummy type parameter.
3
9
type AgdaIO a b = IO b
11
-- | Reads a finite file. Raises an exception if the file path refers
12
-- to a non-physical file (like @/dev/zero@).
14
readFiniteFile :: FilePath -> IO String
16
h <- openFile f ReadMode
17
bracketOnError (return ()) (\_ -> hClose h) (\_ -> hFileSize h)