Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ghc 7.6.1 compatibility (Num is no longer a superclass of Bits)

  • Loading branch information...
commit 4ef2713ad5036862a33d2fd769e769251b62572d 1 parent 8d477cb
Edward Kmett authored
8 representable-tries.cabal
View
@@ -1,6 +1,6 @@
name: representable-tries
category: Data Structures, Functors, Monads, Comonads
-version: 3.0
+version: 3.0.1
license: BSD3
cabal-version: >= 1.6
license-file: LICENSE
@@ -36,17 +36,17 @@ library
UndecidableInstances
build-depends:
- adjunctions == 3.0.*,
+ adjunctions >= 3.0.0.1 && < 3.1,
base >= 4 && < 5,
bifunctors == 3.0.*,
comonad == 3.0.*,
comonad-transformers == 3.0.*,
containers >= 0.3 && < 0.6,
distributive >= 0.2.2 && < 0.3,
- keys == 3.0.*,
+ keys >= 3.0.0.1 && < 3.1,
mtl >= 2.0.1 && < 2.2,
transformers >= 0.2 && < 0.4,
- representable-functors == 3.0.*,
+ representable-functors >= 3.0.0.1 && < 3.1,
semigroups >= 0.8.3.1 && < 0.9,
semigroupoids == 3.0.*
8 src/Data/Functor/Representable/Trie.hs
View
@@ -301,7 +301,7 @@ instance (HasTrie v) => HasTrie (IntMap v) where
-- | Extract bits in little-endian order
-bits :: Bits t => t -> [Bool]
+bits :: (Num t, Bits t) => t -> [Bool]
bits 0 = []
bits x = testBit x 0 : bits (shiftR x 1)
@@ -311,17 +311,17 @@ unbit False = 0
unbit True = 1
-- | Bit list to value
-unbits :: Bits t => [Bool] -> t
+unbits :: (Num t, Bits t) => [Bool] -> t
unbits [] = 0
unbits (x:xs) = unbit x .|. shiftL (unbits xs) 1
-unbitsZ :: (Bits n) => (Bool,[Bool]) -> n
+unbitsZ :: (Num n, Bits n) => (Bool,[Bool]) -> n
unbitsZ (positive,bs) = sig (unbits bs)
where
sig | positive = id
| otherwise = negate
-bitsZ :: (Ord n, Bits n) => n -> (Bool,[Bool])
+bitsZ :: (Ord n, Num n, Bits n) => n -> (Bool,[Bool])
bitsZ = (>= 0) &&& (bits . abs)
-- TODO: fix the show instance of this
Please sign in to comment.
Something went wrong with that request. Please try again.