HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulefoundation-0.0.30Haskell2010

Foundation.IO

IO Routine

  • 1 type
  • 10 values

Terminal

4 declarations
valueputStrLn :: String -> IO ()
#

Print a string with a newline to standard output

File

7 declarations
datadata IOMode
#

See GHC.Internal.System.IO.openFile

Instances6Enum, Eq, Ord, Read, Show, Ix
  • Enum IOModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.IOMode
  • Eq IOModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.IOMode
  • Ord IOModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.IOMode
  • Read IOModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.IOMode
  • Show IOModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.IOMode
  • Ix IOModeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.IOMode
valueopenFile :: FilePath -> IOMode -> IO Handle
#

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.