packages feed

opentheory-unicode 1.137 → 1.138

raw patch · 5 files changed

+71/−76 lines, 5 filesdep ~opentheorydep ~opentheory-bitsdep ~opentheory-byte

Dependency ranges changed: opentheory, opentheory-bits, opentheory-byte, opentheory-parser, opentheory-primitive, opentheory-probability

Files

opentheory-unicode.cabal view
@@ -1,5 +1,5 @@ name: opentheory-unicode-version: 1.137+version: 1.138 category: Text synopsis: Unicode characters license: MIT@@ -10,40 +10,35 @@ maintainer: Joe Leslie-Hurd <joe@gilith.com> description:   Unicode characters - this package was automatically generated from the-  OpenTheory package char-1.137+  OpenTheory package char-1.138  library   build-depends:     base >= 4.0 && < 5.0,     QuickCheck >= 2.4.0.1 && < 3.0,-    opentheory-primitive >= 1.3 && < 2.0,-    opentheory >= 1.193 && < 1.196,-    opentheory-byte >= 1.123 && < 1.124,-    opentheory-bits >= 1.63 && < 1.64,-    opentheory-parser >= 1.154 && < 1.156,-    opentheory-probability >= 1.46 && < 1.47-+    opentheory-primitive >= 1.4 && < 2.0,+    opentheory >= 1.193 && < 1.197,+    opentheory-byte >= 1.123 && < 1.125,+    opentheory-bits >= 1.64 && < 1.65,+    opentheory-parser >= 1.154 && < 1.157,+    opentheory-probability >= 1.46 && < 1.48   hs-source-dirs: src-   ghc-options: -Wall-   exposed-modules:-    OpenTheory.Unicode+    OpenTheory.Unicode,     OpenTheory.Unicode.UTF8 -executable opentheory-unicode-test+test-suite opentheory-unicode-test+  type: exitcode-stdio-1.0   build-depends:     base >= 4.0 && < 5.0,     QuickCheck >= 2.4.0.1 && < 3.0,-    opentheory-primitive >= 1.3 && < 2.0,-    opentheory >= 1.193 && < 1.196,-    opentheory-byte >= 1.123 && < 1.124,-    opentheory-bits >= 1.63 && < 1.64,-    opentheory-parser >= 1.154 && < 1.156,-    opentheory-probability >= 1.46 && < 1.47--  hs-source-dirs: src, testsrc-+    opentheory-primitive >= 1.4 && < 2.0,+    opentheory >= 1.193 && < 1.197,+    opentheory-byte >= 1.123 && < 1.125,+    opentheory-bits >= 1.64 && < 1.65,+    opentheory-parser >= 1.154 && < 1.157,+    opentheory-probability >= 1.46 && < 1.48+  hs-source-dirs: src   ghc-options: -Wall--  main-is: Main.hs+  main-is: Test.hs
src/OpenTheory/Unicode.hs view
@@ -21,7 +21,7 @@   deriving (Eq, Ord, Show)  destPlane :: Natural.Natural -> Natural.Natural-destPlane n = Bits.shiftRight n 16+destPlane n = Natural.shiftRight n 16  destPosition :: Natural.Natural -> Natural.Natural destPosition n = Bits.bound n 16@@ -48,7 +48,7 @@   let n2 = if n1 < 64976 then n1 else n1 + 32 in   let pl = n2 `div` 65534 in   let pos = n2 `mod` 65534 in-  let n = pos + Bits.shiftLeft pl 16 in+  let n = pos + Natural.shiftLeft pl 16 in   Unicode n  instance  QuickCheck.Arbitrary Unicode where
src/OpenTheory/Unicode/UTF8.hs view
@@ -61,7 +61,7 @@         Byte.Byte -> Natural.Natural -> Maybe Natural.Natural-}     addContinuationByte b n =       if isContinuationByte b then-        Just (Byte.toNatural (Byte.and b 63) + Bits.shiftLeft n 6)+        Just (Byte.toNatural (Byte.and b 63) + Natural.shiftLeft n 6)       else Nothing  parseNatural :: Parser.Parser Byte.Byte Natural.Natural@@ -95,15 +95,15 @@   where   {-encode2 :: Natural.Natural -> [Byte.Byte]-}     encode2 n =-      let n1 = Bits.shiftRight n 6 in+      let n1 = Natural.shiftRight n 6 in       let b0 = Byte.or 192 (Byte.fromNatural n1) in       let b1 = Byte.or 128 (Byte.fromNatural (Bits.bound n 6)) in       b0 : b1 : []    {-encode3 :: Natural.Natural -> [Byte.Byte]-}     encode3 n =-      let n1 = Bits.shiftRight n 6 in-      let n2 = Bits.shiftRight n1 6 in+      let n1 = Natural.shiftRight n 6 in+      let n2 = Natural.shiftRight n1 6 in       let b0 = Byte.or 224 (Byte.fromNatural n2) in       let b1 = Byte.or 128 (Byte.fromNatural (Bits.bound n1 6)) in       let b2 = Byte.or 128 (Byte.fromNatural (Bits.bound n 6)) in@@ -111,9 +111,9 @@    {-encode4 :: Natural.Natural -> [Byte.Byte]-}     encode4 n =-      let n1 = Bits.shiftRight n 6 in-      let n2 = Bits.shiftRight n1 6 in-      let n3 = Bits.shiftRight n2 6 in+      let n1 = Natural.shiftRight n 6 in+      let n2 = Natural.shiftRight n1 6 in+      let n3 = Natural.shiftRight n2 6 in       let b0 = Byte.or 240 (Byte.fromNatural n3) in       let b1 = Byte.or 128 (Byte.fromNatural (Bits.bound n2 6)) in       let b2 = Byte.or 128 (Byte.fromNatural (Bits.bound n1 6)) in
+ src/Test.hs view
@@ -0,0 +1,43 @@+{- |+module: Main+description: Unicode characters - testing+license: MIT++maintainer: Joe Leslie-Hurd <joe@gilith.com>+stability: provisional+portability: portable+-}+module Main+  ( main )+where++import qualified OpenTheory.List as List+import qualified OpenTheory.Primitive.Byte as Byte+import qualified OpenTheory.Unicode as Unicode+import qualified OpenTheory.Unicode.UTF8 as UTF8+import OpenTheory.Primitive.Test++proposition0 :: [Byte.Byte] -> Bool+proposition0 b = UTF8.reencode (UTF8.decode b) == b++proposition1 :: [Byte.Byte] -> Bool+proposition1 b = List.naturalLength (UTF8.decode b) <= List.naturalLength b++proposition2 :: [Unicode.Unicode] -> Bool+proposition2 c = List.naturalLength c <= List.naturalLength (UTF8.encode c)++proposition3 :: [Either Byte.Byte Unicode.Unicode] -> Bool+proposition3 c =+  List.naturalLength c <= List.naturalLength (UTF8.reencode c)++proposition4 :: [Unicode.Unicode] -> Bool+proposition4 c = UTF8.decode (UTF8.encode c) == map Right c++main :: IO ()+main =+    do check "Proposition 0:\n  !b. UTF8.reencode (UTF8.decode b) = b\n  " proposition0+       check "Proposition 1:\n  !b. length (UTF8.decode b) <= length b\n  " proposition1+       check "Proposition 2:\n  !c. length c <= length (UTF8.encode c)\n  " proposition2+       check "Proposition 3:\n  !c. length c <= length (UTF8.reencode c)\n  " proposition3+       check "Proposition 4:\n  !c. UTF8.decode (UTF8.encode c) = map right c\n  " proposition4+       return ()
− testsrc/Main.hs
@@ -1,43 +0,0 @@-{- |-module: Main-description: Unicode characters - testing-license: MIT--maintainer: Joe Leslie-Hurd <joe@gilith.com>-stability: provisional-portability: portable--}-module Main-  ( main )-where--import qualified OpenTheory.List as List-import qualified OpenTheory.Primitive.Byte as Byte-import qualified OpenTheory.Unicode as Unicode-import qualified OpenTheory.Unicode.UTF8 as UTF8-import OpenTheory.Primitive.Test--proposition0 :: [Byte.Byte] -> Bool-proposition0 b = UTF8.reencode (UTF8.decode b) == b--proposition1 :: [Byte.Byte] -> Bool-proposition1 b = List.naturalLength (UTF8.decode b) <= List.naturalLength b--proposition2 :: [Unicode.Unicode] -> Bool-proposition2 c = List.naturalLength c <= List.naturalLength (UTF8.encode c)--proposition3 :: [Either Byte.Byte Unicode.Unicode] -> Bool-proposition3 c =-  List.naturalLength c <= List.naturalLength (UTF8.reencode c)--proposition4 :: [Unicode.Unicode] -> Bool-proposition4 c = UTF8.decode (UTF8.encode c) == map Right c--main :: IO ()-main =-    do check "Proposition 0:\n  !b. UTF8.reencode (UTF8.decode b) = b\n  " proposition0-       check "Proposition 1:\n  !b. length (UTF8.decode b) <= length b\n  " proposition1-       check "Proposition 2:\n  !c. length c <= length (UTF8.encode c)\n  " proposition2-       check "Proposition 3:\n  !c. length c <= length (UTF8.reencode c)\n  " proposition3-       check "Proposition 4:\n  !c. UTF8.decode (UTF8.encode c) = map right c\n  " proposition4-       return ()