[Haskell-beginners] Install bullet-0.2.2 failure in OS X 10.8.2

Daniel Fischer daniel.is.fischer at googlemail.com
Thu Dec 6 13:44:56 CET 2012


On Donnerstag, 6. Dezember 2012, 12:51:55, Trung Quang Nguyen wrote:
> Hi there,
> 
> After installing c2hs, and run cabal install bullet. I got this error. Did
> I miss any step?

No, the maintainer of bullet just has not updated the package to incorporate 
the changes in base-4.6. 
> 
> Physics/Bullet/Raw/C2HS.hs:211:12:
>     Could not deduce (Eq a) arising from a use of `toBool'
>     from the context (Num a)
>       bound by the type signature for cToBool :: Num a => a -> Bool
>       at Physics/Bullet/Raw/C2HS.hs:211:1-17
>     Possible fix:
>       add (Eq a) to the context of
>         the type signature for cToBool :: Num a => a -> Bool
>     In the expression: toBool
>     In an equation for `cToBool': cToBool = toBool

Formerly, Eq and Show were superclasses of Num (

class (Eq a, Show a) => Num a where...

) but they have been removed recently (they prevented some reasonable Num 
instances unless you mad dummy Eq and Show instances,

instance Num a => Num (e -> a)

for example).

So before base-4.6, a Num constraint implied Eq, that is no longer so.

Quick fix:

$ cabal unpack bullet
- cd bullet-0.2.2
- edit the .cabal file, bumping the version to 0.2.2.1 or so
- edit the sources adding Eq or Show constraints where necessary (you have 
seen one spot, cabal configure and after that cabal build would detect further 
spots if there are any, cabal install too, but if you configure with
--disable-library-profiling --disable-shared, cabal build is quicker to find 
the spots)
- cabal install
(no arguments, so it configures and installs the package from the directory)

Long-term fix: send a patch (or at least a bug report/feature request) to the 
maintainer of bullet.



More information about the Beginners mailing list