Bits not derived from Num?

Trying to compile data-memocombinators 0.4.3 received 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 was obtained from Num . Perhaps this was bad, and the dependency was removed, but now the package is broken. Is there a known solution for this? Maybe I'm using a bad version of something?

I added Num a to the function signature in my copy of the package, but in the long run this may be wrong.

I am using GHC 7.6.1, base 4.6.0.0.

+6
source share
1 answer

This is mentioned in the changelog for GHC 7.6.1 (base 4.6.0.0).

There is no longer the Num superclass in the Bits class.

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

  • Whenever you create an instance of a Bits type, you also make an instance of Num and
  • Whenever you give a restriction on a function, instance, or class a Bits t , also give it a restriction of Num t .

See GHC # 5593 and the mailing list discussion for more information on this solution.

+9
source

Source: https://habr.com/ru/post/926084/


All Articles