-- |-- Module: System.File-- Copyright: 2011 John Millikin-- License: MIT---- Maintainer: jmillikin@gmail.com-- Portability: portable---- Simple 'FilePath'&#x2010;aware wrappers around standard "System.IO"-- computations. See the linked documentation for each computation for-- details on exceptions and operating system interaction.moduleSystem.File(Handle,Mode-- * Binary files,openFile,withFile,readFile,writeFile,appendFile-- * Text files,openTextFile,withTextFile,readTextFile,writeTextFile,appendTextFile)whereimportPreludehiding(FilePath,readFile,writeFile,appendFile)importqualifiedData.ByteStringasBimportqualifiedData.TextasTimportqualifiedData.Text.IOasTimportqualifiedSystem.IOasIOimportSystem.FilePath(FilePath)importSystem.FileIO.Internal(encode)-- | Re&#x2010;exported for convenience.typeHandle=IO.Handle-- | Re&#x2010;exported for convenience.typeMode=IO.IOMode-- | Open a file in binary mode, and return an open 'Handle'. The 'Handle'-- should be 'IO.hClose'd when it is no longer needed.---- 'withFile' is easier to use, because it will handle the 'Handle'&#x2019;s-- lifetime automatically.---- See: 'IO.openBinaryFile'openFile::FilePath->Mode->IOIO.HandleopenFilepath=IO.openBinaryFile(encodepath)-- | Open a file in binary mode, and pass its 'Handle' to a provided-- computation. The 'Handle' will be automatically closed when the-- computation returns.---- See: 'IO.withBinaryFile'withFile::FilePath->Mode->(IO.Handle->IOa)->IOawithFilepath=IO.withBinaryFile(encodepath)-- | Read in the entire contents of a binary file.---- See: 'B.readFile'readFile::FilePath->IOB.ByteStringreadFilepath=B.readFile(encodepath)-- | Replace the entire contents of a binary file with the provided-- 'B.ByteString'.---- See: 'B.writeFile'writeFile::FilePath->B.ByteString->IO()writeFilepath=B.writeFile(encodepath)-- | Append a 'B.ByteString' to a file. If the file does not exist, it will-- be created.---- See: 'B.appendFile'appendFile::FilePath->B.ByteString->IO()appendFilepath=B.appendFile(encodepath)-- | Open a file in text mode, and return an open 'Handle'. The 'Handle'-- should be 'IO.hClose'd when it is no longer needed.---- 'withTextFile' is easier to use, because it will handle the-- 'Handle'&#x2019;s lifetime automatically.---- See: 'IO.openFile'openTextFile::FilePath->Mode->IOIO.HandleopenTextFilepath=IO.openFile(encodepath)-- | Open a file in text mode, and pass its 'Handle' to a provided-- computation. The 'Handle' will be automatically closed when the-- computation returns.---- See: 'IO.withFile'withTextFile::FilePath->Mode->(IO.Handle->IOa)->IOawithTextFilepath=IO.withFile(encodepath)-- | Read in the entire contents of a text file.---- See: 'T.readFile'readTextFile::FilePath->IOT.TextreadTextFilepath=T.readFile(encodepath)-- | Replace the entire contents of a text file with the provided-- 'T.Text'.---- See: 'T.writeFile'writeTextFile::FilePath->T.Text->IO()writeTextFilepath=T.writeFile(encodepath)-- | Append 'T.Text' to a file. If the file does not exist, it will-- be created.---- See: 'T.appendFile'appendTextFile::FilePath->T.Text->IO()appendTextFilepath=T.appendFile(encodepath)