| base-3.0.1.0: Basic libraries | Source code | Contents | Index

GHC.ConsoleHandler |

Portability | non-portable (GHC extensions)
Stability | internal
Maintainer | cvs-ghc@haskell.org

Description
NB. the contents of this module are only available on Windows. Installing Win32 console handlers.
Synopsis

data Handler

= Default
| Ignore
| Catch (ConsoleEvent -> IO ())

installHandler :: Handler -> IO Handler

data ConsoleEvent

= ControlC
| Break
| Close
| Logoff
| Shutdown

flushConsole :: Handle -> IO ()

Documentation

data Handler | Source

Constructors

Default |
Ignore |
Catch (ConsoleEvent -> IO ()) |

installHandler :: Handler -> IO Handler | Source

Allows Windows console events to be caught and handled. To handle a console event, call `installHandler` passing the appropriate `Handler` value. When the event is received, if the `Handler` value is `Catch f`, then a new thread will be spawned by the system to execute `f e`, where `e` is the `ConsoleEvent` that was received.

Note that console events can only be received by an application running in a Windows console. Certain environments that look like consoles do not support console events, these include:

- Cygwin shells with `CYGWIN=tty` set (if you don't set `CYGWIN=tty`, then a Cygwin shell behaves like a Windows console). * Cygwin xterm and rxvt windows * MSYS rxvt windows

In order for your application to receive console events, avoid running it in one of these environments.

data ConsoleEvent | Source

Constructors

ControlC |
Break |
Close |
Logoff |
Shutdown |

Instances

Enum ConsoleEvent
Eq ConsoleEvent
Ord ConsoleEvent
Read ConsoleEvent
Show ConsoleEvent
Typeable ConsoleEvent

flushConsole :: Handle -> IO () | Source

Produced by Haddock version 0.8