patch applied (packages/X11): fill in Image routines in X11 (#982 from Frederik Eaton)

Simon Marlow simonmarhaskell at gmail.com
Mon Nov 6 05:47:33 EST 2006


Sven Panne wrote:
> Am Freitag, 3. November 2006 11:37 schrieb Ross Paterson:
> 
>>Fri Nov  3 02:35:59 PST 2006  Ross Paterson <ross at soi.city.ac.uk>
>>  * fill in Image routines in X11 (#982 from Frederik Eaton)
>>
>>    M ./Graphics/X11/Types.hsc +12
>>    M ./Graphics/X11/Xlib/Misc.hsc -11 +7
>>    M ./Graphics/X11/Xlib/Types.hsc -1 +9
>>    M ./X11.cabal -1 +2
>>[...]
> 
> 
> FYI: I've made this patch compile by telling the X11 headers to use normal 
> prototypes (not macros) for the image functions. In addition I have 3 remarks 
> about the X11 package:
> 
>    * Strictly spoken, the majority of types are wrong: An Int is not a CInt, 
> and the binding will fail on platforms where the actual representation is 
> different. There should be a general code review of all the types in the 
> "foreign import"s.
> 
>    * Even if the point above is fixed, the X11 binding is not really typed, 
> because tons of things are simply Ints (or better: CInts) and X11 constants 
> are not Haskell constructors but simply integral values. caused by the use of 
> "type" instead of the more correct "newtype". This can be fixed by a little 
> bit of more or less mechanical work, but it will of course introduce an 
> incompatible API change on the Haskell side. What do other people think about 
> this direction?

I agree it would be nice to tidy up the API in these two respects too.  I 
presume synonyms were used because defining all the instances for a newtype was 
too much hassle - nowadays it's easy with GHC's newtype deriving, but still 
diffiult with Hugs.  However, there are macros to make it easier that we used 
for Foreign.C.

Cheers,
	Simon


More information about the Cvs-libraries mailing list