Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- putChar :: MonadIO m => Char -> m ()
- putStr :: MonadIO m => String -> m ()
- putStrLn :: MonadIO m => String -> m ()
- print :: (MonadIO m, Show a) => a -> m ()
- pprint :: (MonadIO m, Show a) => a -> m ()
- getChar :: MonadIO m => m Char
- getLine :: MonadIO m => m String
- getContents :: MonadIO m => m String
- interact :: MonadIO m => (String -> String) -> m ()
- readFile :: MonadIO m => FilePath -> m String
- writeFile :: MonadIO m => FilePath -> String -> m ()
- appendFile :: FilePath -> String -> IO ()
- ioError :: MonadIO m => IOError -> m a
- type FilePath = String
- userError :: String -> IOError
- type IOError = IOException
Documentation
getContents :: MonadIO m => m String Source #
File and directory names are values of type String
, whose precise
meaning is operating system dependent. Files can be opened, yielding a
handle which can then be used to operate on the contents of that file.
userError :: String -> IOError #
Construct an IOException
value with a string describing the error.
The fail
method of the IO
instance of the Monad
class raises a
userError
, thus:
instance Monad IO where ... fail s = ioError (userError s)
type IOError = IOException #
The Haskell 2010 type for exceptions in the IO
monad.
Any I/O operation may raise an IOException
instead of returning a result.
For a more general type of exception, including also those that arise
in pure code, see Exception
.
In Haskell 2010, this is an opaque type.