opentheory-bits 1.63 → 1.64
raw patch · 2 files changed
+10/−22 lines, 2 filesdep ~opentheorydep ~opentheory-primitivedep ~opentheory-probability
Dependency ranges changed: opentheory, opentheory-primitive, opentheory-probability
Files
- opentheory-bits.cabal +6/−9
- src/OpenTheory/Natural/Bits.hs +4/−13
opentheory-bits.cabal view
@@ -1,5 +1,5 @@ name: opentheory-bits-version: 1.63+version: 1.64 category: Formal Methods synopsis: Natural number to bit-list conversions license: MIT@@ -10,20 +10,17 @@ maintainer: Joe Leslie-Hurd <joe@gilith.com> description: Natural number to bit-list conversions - this package was automatically- generated from the OpenTheory package natural-bits-1.63+ generated from the OpenTheory package natural-bits-1.64 library build-depends: base >= 4.0 && < 5.0, QuickCheck >= 2.4.0.1 && < 3.0,- opentheory-primitive >= 1.3 && < 2.0,- opentheory >= 1.195 && < 1.196,- opentheory-probability >= 1.46 && < 1.47-+ opentheory-primitive >= 1.4 && < 2.0,+ opentheory >= 1.195 && < 1.197,+ opentheory-probability >= 1.46 && < 1.48 hs-source-dirs: src- ghc-options: -Wall- exposed-modules:- OpenTheory.Natural.Bits+ OpenTheory.Natural.Bits, OpenTheory.Natural.Uniform
src/OpenTheory/Natural/Bits.hs view
@@ -26,29 +26,20 @@ headBits :: Primitive.Natural.Natural -> Bool headBits n = Natural.naturalOdd n -shiftRight ::- Primitive.Natural.Natural -> Primitive.Natural.Natural ->- Primitive.Natural.Natural-shiftRight n k = n `div` 2 ^ k- bit :: Primitive.Natural.Natural -> Primitive.Natural.Natural -> Bool-bit n i = headBits (shiftRight n i)+bit n i = headBits (Primitive.Natural.shiftRight n i) bound :: Primitive.Natural.Natural -> Primitive.Natural.Natural -> Primitive.Natural.Natural-bound n k = n `mod` 2 ^ k+bound n k =+ n - Primitive.Natural.shiftLeft (Primitive.Natural.shiftRight n k) k fromList :: [Bool] -> Primitive.Natural.Natural fromList l = append l 0 -shiftLeft ::- Primitive.Natural.Natural -> Primitive.Natural.Natural ->- Primitive.Natural.Natural-shiftLeft n k = 2 ^ k * n- tailBits :: Primitive.Natural.Natural -> Primitive.Natural.Natural-tailBits n = n `div` 2+tailBits n = Primitive.Natural.shiftRight n 1 toList :: Primitive.Natural.Natural -> [Bool] toList n = if n == 0 then [] else headBits n : toList (tailBits n)