IO
A value of type
IO a is a computation which, when
performed, does some I/O before returning a value of type
a.
There is really only one way to "perform" an I/O action: bind it to
Main.main in your program. When your program is run, the I/O
will be performed. It isn't possible to perform I/O from an arbitrary
function, unless that function is itself in the
IO monad and
called at some point, directly or indirectly, from
Main.main.
IO is a monad, so
IO actions can be combined using
either the do-notation or the
>> and
>>=
operations from the
Monad class.
A value of type
IO a is a computation which, when
performed, does some I/O before returning a value of type
a.
There is really only one way to "perform" an I/O action: bind it to
Main.main in your program. When your program is run, the I/O
will be performed. It isn't possible to perform I/O from an arbitrary
function, unless that function is itself in the
IO monad and
called at some point, directly or indirectly, from
Main.main.
IO is a monad, so
IO actions can be combined using
either the do-notation or the
>> and
>>=
operations from the
Monad class.
Basic concurrency stuff.
The API of this module is unstable and not meant to be consumed by
the general public. If you absolutely must depend on it, make sure
to use a tight upper bound, e.g., base < 4.X rather than
base < 5, because the interface can change rapidly without
much warning.
Definitions for the
IO monad and its friends.
The API of this module is unstable and not meant to be consumed by
the general public. If you absolutely must depend on it, make sure
to use a tight upper bound, e.g.,
base < 4.X rather than
base < 5, because the interface can change rapidly without
much warning.
Efficient locale-sensitive support for text I/O.
The functions in this module obey the runtime system's locale,
character set encoding, and line ending conversion settings.
If you want to do I/O using the UTF-8 encoding, use
Data.Text.IO.Utf8, which is faster than this module.
If you know in advance that you will be working with data that has a
specific encoding, and your application is highly performance
sensitive, you may find that it is faster to perform I/O with
bytestrings and to encode and decode yourself than to use the
functions in this module.
Warning: this is an internal module, and does not have a stable
API or name. Functions in this module may not check or enforce
preconditions expected by public modules. Use at your own risk!
Low-level support for text I/O.
Efficient locale-sensitive support for lazy text I/O.
The functions in this module obey the runtime system's locale,
character set encoding, and line ending conversion settings.
If you know in advance that you will be working with data that has a
specific encoding (e.g. UTF-8), and your application is highly
performance sensitive, you may find that it is faster to perform I/O
with bytestrings and to encode and decode yourself than to use the
functions in this module.
Mutable boxed and unboxed arrays in the IO monad.
POSIX IO support. These types and functions correspond to the unix
functions open(2), close(2), etc. For more portable functions which
are more like fopen(3) and friends from stdio.h, see
System.IO.
Input and output actions.
A value of type
IO a is a computation which, when
performed, does some I/O before returning a value of type
a.
There is really only one way to "perform" an I/O action: bind it to
Main.main in your program. When your program is run, the I/O
will be performed. It isn't possible to perform I/O from an arbitrary
function, unless that function is itself in the
IO monad and
called at some point, directly or indirectly, from
Main.main.
IO is a monad, so
IO actions can be combined using
either the do-notation or the
>> and
>>=
operations from the
Monad class.
Generalized impure cryptographic hash interface
This module provides a stateful, IO-based interface to Haskeline,
which may be easier to integrate into some existing programs or
libraries.
It is strongly recommended to use the safer, monadic API of
System.Console.Haskeline, if possible, rather than the explicit
state management functions of this module.
The equivalent REPL example is:
import System.Console.Haskeline
import System.Console.Haskeline.IO
import Control.Concurrent
main = bracketOnError (initializeInput defaultSettings)
cancelInput -- This will only be called if an exception such
-- as a SigINT is received.
(\hd -> loop hd >> closeInput hd)
where
loop :: InputState -> IO ()
loop hd = do
minput <- queryInput hd (getInputLine "% ")
case minput of
Nothing -> return ()
Just "quit" -> return ()
Just input -> do queryInput hd $ outputStrLn
$ "Input was: " ++ input
loop hd
Default ways to perform
PandocMonad actions in a
MonadIO type.
These functions are used to make the
PandocIO type
an instance of
PandocMonad, but can be reused for any
other MonadIO-conforming types.
This module provides an interface to
System.Directory for users
of the
Path module. It also implements some extra functionality
like recursive scanning and copying of directories, working with
temporary files/directories, etc.
This module provides wrappers in
IO around the functions from
Data.HashTable.Class.
This module exports three concrete hash table types, one for each hash
table implementation in this package:
type BasicHashTable k v = IOHashTable (B.HashTable) k v
type CuckooHashTable k v = IOHashTable (Cu.HashTable) k v
type LinearHashTable k v = IOHashTable (L.HashTable) k v
The
IOHashTable type can be thought of as a wrapper around a
concrete hashtable type, which sets the
ST monad state type
to
PrimState IO, a.k.a.
RealWorld:
type IOHashTable tabletype k v = tabletype (PrimState IO) k v
This module provides
stToIO wrappers around the hashtable
functions (which are in
ST) to make it convenient to use them
in
IO. It is intended to be imported qualified and used with a
user-defined type alias, i.e.:
import qualified Data.HashTable.IO as H
type HashTable k v = H.CuckooHashTable k v
foo :: IO (HashTable Int Int)
foo = do
ht <- H.new
H.insert ht 1 1
return ht
Essentially, anywhere you see
IOHashTable h k v in the
type signatures below, you can plug in any of
BasicHashTable k v,
CuckooHashTable k
v, or
LinearHashTable k v.
TextShow instances for
IO-related data types.
Since: 2
Various utility functions to help with custom I/O of Dot code.