[Haskell-cafe] Problem with Gtk2hs

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sun Dec 9 22:40:34 EST 2007


On Sat, 2007-12-08 at 13:08 -0800, Stefan O'Rear wrote: 
> On Sat, Dec 08, 2007 at 08:33:36PM +0000, Andrew Coppin wrote:
> > I just spent the evening writing a library that's a thin layer over Gtk2hs. 
> > It took an age to get it to compile, but eventually it worked. Yay!
> >
> > When I ran it, I got this:
> >
> > Test2: gtk/Graphics/UI/Gtk/Gdk/PixbufData.hs.pp:58:0: No instance nor 
> > default method for class operation Data.Array.Base.getNumElements
> >
> > Er... wow.
> >
> > OK, at this point, I am completely stumped. Any hints?
> 
> That's pretty obviously a bug - Graphics.UI.Gtk.Gdk.PixbufData doesn't
> fully implement the (M)Array class.

The MArray class changed in ghc-6.8 and we didn't notice until the
gtk2hs release was already out.

So there are a couple workarounds, either grab the darcs version of the
0.9.12 branch which contains the fix:
http://darcs.haskell.org/gtk2hs-branches/gtk2hs-0.9.12/

Or use the released version with ghc-6.6.x rather than 6.8.x, since 6.6
has the previous different MArray interface.

Or use the unsafe indexing operators which bypass the bounds check which
calls getNumElements.


Duncan



More information about the Haskell-Cafe mailing list