wx file error when using Haskell

Tag: haskell Author: tanz1988 Date: 2009-08-22

I am trying to learn to use the wx packages to make GUI programs in Haskell with the following code:

module Main where
import Graphics.UI.WX

gui :: IO ()
gui = do
 f <- frame [text :="Hello World!"]
 staticText f [text :="Some static text"]
 return ()


main :: IO()
main = start gui

But when I try to compile this I get the following error:

C:\Haskell>ghc -O2 --make gui.hs
[1 of 1] Compiling Main             ( gui.hs, gui.o )

gui.hs:2:0:
    Bad interface file: C:\temp\wxhaskell-0.11.1.2\lib\imports\Graphics

        mismatched interface file versions (wanted "6103", got "6104")

This is after I installed wx from a binary file that is the latest version. What do I do to make this compile or get wx to work in general?

EDIT: On further inspection it turns out I am using using:

C:\Haskell>ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.10.3

Best Answer

You have GHC version 6.10.3 and it seems you've wxHaskell pre-compiled with GHC version 6.10.4. That's the mismatch.

Possibilities: -downgrade wxHaskell -upgrade to GHC version 6.10.4

It seems many pre-build packages are in transition from being build in version 6.10.3 to 6.10.4. This is annoying. I think time will resolve these kind of issues?

Other Answer1

Judging by the error message, either download GHC 6.10.3, or build wxHaskell from source on GHC 6.10.4. The first should be much simpler.

UPDATE: Since you are actually using GHC 6.10.3, you need to download GHC 6.10.4.

comments:

Does this mean I have to "downgrade" my GHC?