On Thu, 2007-11-08 at 12:08 +0100, Joel Wilsson wrote:
> Anyway, here is the error message I'm getting:
> C:\Program Files\Gtk2Hs\demos\fastdraw>ghc --make FastDraw.hs
> [1 of 1] Compiling Main ( FastDraw.hs, FastDraw.o )
> Linking FastDraw.exe ...
> C:\Program Files\Gtk2Hs\demos\fastdraw>fastdraw.exe
> bytes per row: 768, channels per pixel: 3, bits per sample: 8
> fastdraw.exe: gtk/Graphics/UI/Gtk/Gdk/PixbufData.hs.pp:58:0: No instance nor def
> ault method for class operation Data.Array.Base.getNumElements
> C:\Program Files\Gtk2Hs\demos\fastdraw>ghc --version
> The Glorious Glasgow Haskell Compilation System, version 6.8.1
Yes. I get the same.
What has happened is that in GHC 6.8.x the definition of the MArray type
class has changed to add a new method getNumElements which is used to do
an extra bounds check to guard against incorrectly written Ix instances.
So we were missing this class method. I've added it in the darcs version
but that doesn't help you a lot in the short term.
There are a couple workarounds, one is to use ghc-6.6.1 (the installer
supports both 6.6.1 and 6.8.1), the other is to use
unsafeRead/unsafeWrite rather than readArray/writeArray. This bypasses
the bounds check that uses getNumElements.
import Data.Array.Base (readArray, writeArray)
unsafeRead/unsafeWrite always use Int indexes.