Portable keyboard signal handling
Simon Marlow
simonmarhaskell at gmail.com
Mon Sep 4 05:10:00 EDT 2006
Robert Dockins wrote:
> On Friday 01 September 2006 03:55, Simon Peyton-Jones wrote:
>
>>| Indeed. I had to browse the source after finding that the Haddock
>>docs are
>>| essentially useless. I do have to say, one nice side effect of using
>>darcs
>>| is that one can simply point one's browser at the source repository to
>>peruse
>>| the code. I've bookmarked http://cvs.haskell.org/darcs :-)
>>
>>Good idea. Could you help us improve the documentation by sending darcs
>>patches with Haddock docs in them? Not necessarily comprehensive: at
>>least recording the bits you discovered, and wished had been in the docs
>>in the first place.
>
>
> Well, here's the odd thing; there ought to be meaningful haddock docs already.
> By that, I mean that there are data declarations and type signatures and such
> already in the file that haddock should be picking up on. However, the whole
> file is protected by a big ifdef:
>
> module GHC.ConsoleHandler
> #if !defined(mingw32_HOST_OS) && !defined(__HADDOCK__)
> where
> import Prelude -- necessary to get dependencies right
> #else /* whole file */
> ( Handler(..)
> , installHandler
> , ConsoleEvent(..)
> , flushConsole
> ) where
>
> ..... rest of file ....
>
>
> It looks like the definitions in the file _should_ be visible to haddock, but
> for some reason they aren't.
The !defined(__HADDOCK__) part was added by me recently, so you have to look in
the snapshot docs to find the results:
http://www.haskell.org/ghc/dist/current/docs/libraries/base/GHC-ConsoleHandler.html
GHC.ConsoleHandler is now included in the documentation, and will be in 6.6.
> Do you have any ideas about the original question? It looks like RTS trickery
> is necessary to get this right in general. Looking at this file in a little
> more detail, I see calls to 'rts_installHandler', which is surely why this
> file is in the GHC.* namespace.
>
> Perhaps 'withControlCHandler' or something like it should go into the
> libraries somewhere? I'm not sure this is a function that can be provided
> without RTS assistance. It also seems to be about the maximum intersection
> of the capabilities of Posix signals and of the Win32 console events system.
Right, that would be useful. However, see this bug:
http://hackage.haskell.org/trac/ghc/ticket/637
Ctrl-C doesn't work right on Windows with -threaded, at the moment. (we hope to
get to this one for 6.6.1).
Cheers,
Simon
More information about the Libraries
mailing list