home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / hugs_1 / !Hugs_lib_IO < prev    next >
Encoding:
Text File  |  1996-08-12  |  1.6 KB  |  48 lines

  1. -----------------------------------------------------------------------------
  2. -- Standard Library: IO operations, beyond those included in the prelude
  3. --
  4. -- WARNING: The names and semantics of functions defined in this module
  5. -- may change as the details of the IO standard are clarified.
  6. --
  7. -- Suitable for use with Hugs 1.3.
  8. -----------------------------------------------------------------------------
  9.  
  10. module IO where
  11.  
  12. -- Functions for inspecting IOErrors:
  13.  
  14. primitive isUserError       :: IOError -> Maybe String
  15. primitive isIllegalError,
  16.           isAlreadyExists,
  17.           isAlreadyInUse,
  18.           isFullError,
  19.           isEOFError,
  20.           isPermissionError :: IOError -> Bool
  21. primitive ioeGetHandle      :: IOError -> Maybe Handle
  22. primitive ioeGetFileName    :: IOError -> Maybe FilePath
  23.  
  24. -- Various handle-oriented operations:
  25.  
  26. data Handle            -- builtin datatype of IO handles
  27.  
  28. data IOMode = ReadMode | WriteMode | AppendMode
  29.               deriving (Eq, Ord, Enum, Show, Read)
  30.  
  31. primitive stdin        :: Handle
  32. primitive stdout       :: Handle
  33. primitive stderr       :: Handle
  34. primitive hGetContents :: Handle -> IO String
  35. primitive openFile     :: FilePath -> IOMode -> IO Handle
  36. primitive hClose       :: Handle -> IO ()
  37. primitive hFlush       :: Handle -> IO ()
  38. primitive hIsEOF       :: Handle -> IO Bool
  39. primitive hPutChar     :: Handle -> Char -> IO ()
  40. primitive hPutStr      :: Handle -> String -> IO ()
  41. primitive hGetChar     :: Handle -> IO Char
  42. primitive getCh        :: IO Char
  43.  
  44. isEOF                       :: IO Bool
  45. isEOF                        = hIsEOF stdin
  46.  
  47. -----------------------------------------------------------------------------
  48.