ghc-7.6: add missing Num instance for Bits

Fixes the following build failure:
    src/runtime/haskell/Data/Binary/IEEE754.lhs:256:17:
        Could not deduce (Num a) arising from a use of `mask'
        from the context (Bits a)
          bound by the type signature for
                     clamp :: Bits a => BitCount -> a -> a
This commit is contained in:
Sergei Trofimovich
2013-03-09 21:19:53 +00:00
parent 8e4d460c6f
commit 8d00819790

View File

@@ -252,7 +252,7 @@ rawToBytes raw = integerToBytes mashed width where
in positions above the count.
\begin{code}
clamp :: Bits a => BitCount -> a -> a
clamp :: (Num a, Bits a) => BitCount -> a -> a
clamp = (.&.) . mask where
mask 1 = 1
mask n | n > 1 = (mask (n - 1) `shiftL` 1) + 1