So recently, I have been trying to dive back into programming with a little more oomph than a one-off project. I figured setting up a GUI along side would help keep me motivated. Now my current computer is an older Mac Book Pro because it is one of the few laptops in the house with a working battery. After diving around a large amount of fluff without any real substance, I decided going with wxHaskell would be the better choice. So I made sure wx was installed and did a cabal install wx, and wouldn't you know it that it failed.
src/haskell/Graphics/UI/WXCore/WxcTypes.hs:752:20: error:
Ambiguous occurrence ‘CBool’
It could refer to either ‘Foreign.C.CBool’,
imported from ‘Foreign.C’ at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:126:1-16
(and originally defined in ‘Foreign.C.Types’)
or ‘Graphics.UI.WXCore.WxcTypes.CBool’,
defined at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:750:1
|
752 | toCBool :: Bool -> CBool
| ^^^^^
src/haskell/Graphics/UI/WXCore/WxcTypes.hs:755:22: error:
Ambiguous occurrence ‘CBool’
It could refer to either ‘Foreign.C.CBool’,
imported from ‘Foreign.C’ at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:126:1-16
(and originally defined in ‘Foreign.C.Types’)
or ‘Graphics.UI.WXCore.WxcTypes.CBool’,
defined at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:750:1
|
755 | withBoolResult :: IO CBool -> IO Bool
| ^^^^^
src/haskell/Graphics/UI/WXCore/WxcTypes.hs:760:14: error:
Ambiguous occurrence ‘CBool’
It could refer to either ‘Foreign.C.CBool’,
imported from ‘Foreign.C’ at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:126:1-16
(and originally defined in ‘Foreign.C.Types’)
or ‘Graphics.UI.WXCore.WxcTypes.CBool’,
defined at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:750:1
|
760 | fromCBool :: CBool -> Bool
| ^^^^^
src/haskell/Graphics/UI/WXCore/WxcTypes.hs:763:55: error:
Ambiguous occurrence ‘CBool’
It could refer to either ‘Foreign.C.CBool’,
imported from ‘Foreign.C’ at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:126:1-16
(and originally defined in ‘Foreign.C.Types’)
or ‘Graphics.UI.WXCore.WxcTypes.CBool’,
defined at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:750:1
|
763 | foreign import ccall "intToBool" intToCBool :: Int -> CBool
| ^^^^^
src/haskell/Graphics/UI/WXCore/WxcTypes.hs:764:48: error:
Ambiguous occurrence ‘CBool’
It could refer to either ‘Foreign.C.CBool’,
imported from ‘Foreign.C’ at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:126:1-16
(and originally defined in ‘Foreign.C.Types’)
or ‘Graphics.UI.WXCore.WxcTypes.CBool’,
defined at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:750:1
|
764 | foreign import ccall "boolToInt" cboolToInt :: CBool -> Int
| ^^^^^
cabal: Leaving directory '/var/folders/8_/gbh6jvpj5dng4lmty_f9bjwh0000gn/T/cabal-tmp-50540/wxcore-0.92.3.0'
cabal: Error: some packages failed to install:
wx-0.92.3.0-GsmnFZQfuQrJCt8TV3hj5w depends on wx-0.92.3.0 which failed to
install.
wxcore-0.92.3.0-Cn2phmaLu563t5S6tEBzjw failed during the building phase. The
exception was:
ExitFailure 1
So with that big mess, it was time to hunt for what to do. With any luck this will be fixed soon because I generally have very little idea of what I'm doing. So the first step was to see if there was an alternative without manual intervention. Nope. So, I downloaded the package that was having the problem.
https://hackage.haskell.org/package/wxcore
Then we extract and open up src/haskell/Graphics/UI/WXCore/WxcTypes.hs and edit line 127 to
import Foreign.C hiding (CBool)
Save the file, open up a terminal. Navigate to the wxcore-0.92.3.0 folder and run
cabal install
After it hopefully succeeds, which it did for me, just simply
cabal install wx
I hope this helps anyone that needs and that the need doesn't last too long. I came across someone mentioning this fix on Stack overflow I think, but I can't find the link to it and don't plan to search too hard for it.