HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Modulefoundation-0.0.30Haskell2010

Foundation.IO

IO Routine

Contents
  1. Terminal
  2. File
Synopsis

Terminal

File

datadata IOMode

See GHC.Internal.System.IO.openFile

Instances6Enum, Eq, Ord, Read, Show, Ix
  • Enum IOModeDefined in ghc-internal-10.0.0 · GHC.Internal.IO.IOMode
  • Eq IOModeDefined in ghc-internal-10.0.0 · GHC.Internal.IO.IOMode
  • Ord IOModeDefined in ghc-internal-10.0.0 · GHC.Internal.IO.IOMode
  • Read IOModeDefined in ghc-internal-10.0.0 · GHC.Internal.IO.IOMode
  • Show IOModeDefined in ghc-internal-10.0.0 · GHC.Internal.IO.IOMode
  • Ix IOModeDefined in ghc-internal-10.0.0 · GHC.Internal.IO.IOMode

list the file name in the given FilePath directory

TODO: error management and not implemented yet getDirectory :: FilePath -> IO [FileName] getDirectory = undefined

Open a new handle on the file

valuewithFile :: FilePath -> IOMode -> (Handle -> IO r) -> IO r

withFile filepath mode act opens a file using the mode and run act. the by-product handle will be closed when act finish, either normally or through an exception.

The value returned is the result of act@

valuehGet :: Handle -> Int -> IO (UArray Word8)

Read binary data directly from the specified Handle.

First argument is the Handle to read from, and the second is the number of bytes to read. It returns the bytes read, up to the specified size, or an empty array if EOF has been reached.

hGet is implemented in terms of hGetBuf.