Bits is not derived from Num?

ghc, haskell

Solution

It's mentioned in the changelog for GHC 7.6.1 (base 4.6.0.0).

The `Bits` class does not have a `Num` superclass anymore.

You can make code that works with both Haskell98/Haskell2010 and GHC by:

- Whenever you make a `Bits` instance of a type, also make `Num` instance, and

- Whenever you give a function, instance or class a `Bits t` constraint, also give it a `Num t` constraint.

See GHC #5593 and the mailing list discussion for more information about this decision.

Problem

Trying to compile data-memocombinators 0.4.3, got the following error: ``` Data/MemoCombinators.hs:119:10: Could not deduce (Num a) arising from a use of `IntTrie.apply' from the context (Ord a, Bits a) ``` I think `Bits` used to be derived from `Num`. Perhaps it was bad and the dependency was removed, but now the package is broken. Is there any known fix for this? Perhaps I'm using a bad version of something? I have added `Num a` to the function signature in my copy of the package for the time being, but this can't be right in the long term. I'm using GHC 7.6.1, base is 4.6.0.0.

Original source