[Haskell-cafe] X Haskell Bindings

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sun Aug 17 21:18:45 EDT 2008

On 2008 Aug 17, at 20:34, Spencer Janssen wrote:
> On Sat, Aug 16, 2008 at 04:07:25PM -0500, Antoine Latter wrote:
>> Since the request to create a window has so many parameters, these
>> parameters are all wrapped up into a "CreateWindow" data type, which
>> is only ever used by the "createWindow" function.  The "mapWindow"
>> request only has one parameter, so it does not need it's own
>> "MapWindow" data type.
> I think this is a nice idea.  This type signature from the X11  
> library is
> absolutely unmanageable:

It's never been manageable, even from C (hence XCreateSimpleWindow()  
in Xlib which defaults most of that).

>    do h <- getHandler c -- save the old handler so we can restore it  
> later
>       setHandler c myHandlingFn
>       performSomeActionsWhichMayFail
>       setHandler c h
> Not only is this code ugly, it does not work correctly when the  
> connection may
> be concurrently used by several threads.

or when the async response comes after the handler's been reset (i.e.  
you need to call XSynchronize() and handle any errors before resetting  
the handler).

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list