packages feed

hex-text 0.1.0.4 → 0.1.0.6

raw patch · 5 files changed

+80/−82 lines, 5 filesdep ~basedep ~textPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, text

API changes (from Hackage documentation)

Files

README.md view
@@ -4,7 +4,7 @@  # Motivation -When using Stripe for payments, Stripe sends a signature as a hexidecimal `Text` value. The `cryptonite` package can be used to verify the signature, but it requires `ByteString` values, not `Text`. +When using Stripe for payments, Stripe sends a signature as a hexidecimal `Text` value. The `cryptonite` package can be used to verify the signature, but it requires `ByteString` values, not `Text`.  # Example usage @@ -17,4 +17,3 @@ λ> (encodeHex . pack) [1, 2, 3, 253, 254, 255] "010203fdfeff" ```-
changelog.txt view
@@ -7,3 +7,6 @@ Version 0.1.0.4, published March 2021:   ★ Adds support for GHC 9.0   ★ Removes the test suite's dependency on doctest++Version 0.1.0.6, published March 2022:+  ★ Adds support for GHC 9.2
hex-text.cabal view
@@ -1,7 +1,7 @@-cabal-version: 2.2+cabal-version: 3.0  name: hex-text-version: 0.1.0.4+version: 0.1.0.6 category: Text  synopsis: ByteString-Text hexidecimal conversions@@ -21,42 +21,31 @@  build-type: Simple -tested-with:-    GHC == 8.0.2-  , GHC == 8.2.2-  , GHC == 8.4.3-  , GHC == 8.6.5-  , GHC == 8.8.4-  , GHC == 8.10.3-  , GHC == 9.0.1- extra-source-files:     README.md     changelog.txt  source-repository head-  type: git-  location: https://github.com/typeclasses/hex-text+    type: git+    location: https://github.com/typeclasses/hex-text +common base+    default-language: Haskell2010+    build-depends:+        base ^>= 4.9 || ^>= 4.10 || ^>= 4.11 || ^>= 4.12 || ^>= 4.13 || ^>= 4.14 || ^>= 4.15 || ^>= 4.16+      , base16-bytestring ^>= 1.0+      , bytestring ^>= 0.10 || ^>= 0.11+      , text ^>= 1.2+ library-  default-language: Haskell2010-  ghc-options: -Wall-  hs-source-dirs: src-  build-depends:-      base >=4.9 && <4.16-    , base16-bytestring ^>= 1.0-    , bytestring ^>=0.10 || ^>=0.11-    , text ^>= 1.2-  exposed-modules:-      Text.Hex+    import: base+    ghc-options: -Wall+    hs-source-dirs: src+    exposed-modules: Text.Hex -test-suite test-  default-language: Haskell2010-  hs-source-dirs: test-  type: exitcode-stdio-1.0-  main-is: test.hs-  build-depends:-      base >=4.9 && <4.16-    , bytestring ^>=0.10 || ^>=0.11-    , hex-text-    , text ^>= 1.2+test-suite test-hex-text+    import: base+    hs-source-dirs: test+    type: exitcode-stdio-1.0+    main-is: Main.hs+    build-depends: hex-text
+ test/Main.hs view
@@ -0,0 +1,54 @@+import Data.Foldable (Foldable (fold))+import Data.Semigroup ()+import Data.String (IsString (fromString))+import Numeric.Natural (Natural)+import System.Exit (die)+import Text.Hex (decodeHex, encodeHex, lazilyEncodeHex)++import qualified Data.ByteString as ByteString+import qualified Data.ByteString.Lazy as LazyByteString+import qualified Data.Text as Text+import qualified Data.Text.Lazy as LazyText++main :: IO ()+main = run tests++tests :: [Natural]+tests = encodeHexTests ++ decodeHexTests ++ lazilyEncodeHexTests++run :: [Natural] -> IO ()+run [] = putStrLn "Okay"+run xs = die $ "Test failures: " ++ show (xs :: [Natural])++infix 0 #+(#) :: a -> Bool -> [a]+x # True  = []+x # False = [x]++encodeHexTests :: [Natural]+encodeHexTests = fold+  [ 1 # (encodeHex . ByteString.singleton) 192+      == fromString "c0"+  , 2 # (encodeHex . ByteString.singleton) 168+      == fromString "a8"+  , 3 # (encodeHex . ByteString.pack) [192, 168, 1, 2]+      == fromString "c0a80102"+  ]++decodeHexTests :: [Natural]+decodeHexTests = fold+  [ 4 # (fmap ByteString.unpack . decodeHex . Text.pack) "c0a80102"+      == Just [192,168,1,2]+  , 5 # (fmap ByteString.unpack . decodeHex . Text.pack) "c0a8010"+      == Nothing+  , 6 # (fmap ByteString.unpack . decodeHex . Text.pack) "x0a80102"+      == Nothing+  , 7 # (fmap ByteString.unpack . decodeHex . Text.pack) "C0A80102"+      == Just [192,168,1,2]+  ]++lazilyEncodeHexTests :: [Natural]+lazilyEncodeHexTests = fold+  [ 8 # (LazyText.take 8 . lazilyEncodeHex . LazyByteString.pack . cycle) [1, 2, 3]+      == fromString "01020301"+  ]
− test/test.hs
@@ -1,47 +0,0 @@-import Data.Foldable-import Data.Semigroup-import Data.String-import Numeric.Natural-import System.Exit-import Text.Hex--import qualified Data.ByteString as ByteString-import qualified Data.ByteString.Lazy as LazyByteString-import qualified Data.Text as Text-import qualified Data.Text.Lazy as LazyText--main = run tests--tests = encodeHexTests <> decodeHexTests <> lazilyEncodeHexTests--run [] = putStrLn "Okay"-run xs = die $ "Test failures: " <> show (xs :: [Natural])--infix 0 #-x # True = []-x # False = [x]--encodeHexTests = fold-  [ 1 # (encodeHex . ByteString.singleton) 192-      == fromString "c0"-  , 2 # (encodeHex . ByteString.singleton) 168-      == fromString "a8"-  , 3 # (encodeHex . ByteString.pack) [192, 168, 1, 2]-      == fromString "c0a80102"-  ]--decodeHexTests = fold-  [ 4 # (fmap ByteString.unpack . decodeHex . Text.pack) "c0a80102"-      == Just [192,168,1,2]-  , 5 # (fmap ByteString.unpack . decodeHex . Text.pack) "c0a8010"-      == Nothing-  , 6 # (fmap ByteString.unpack . decodeHex . Text.pack) "x0a80102"-      == Nothing-  , 7 # (fmap ByteString.unpack . decodeHex . Text.pack) "C0A80102"-      == Just [192,168,1,2]-  ]--lazilyEncodeHexTests = fold-  [ 8 # (LazyText.take 8 . lazilyEncodeHex . LazyByteString.pack . cycle) [1, 2, 3]-      == fromString "01020301"-  ]