ascii 1.1.2.0 → 1.1.3.0
raw patch · 3 files changed
+33/−1 lines, 3 filesdep ~ascii-casedep ~ascii-chardep ~ascii-groupPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ascii-case, ascii-char, ascii-group, ascii-numbers, ascii-predicates, ascii-superset, ascii-th
API changes (from Hackage documentation)
+ ASCII: digitString :: DigitStringSuperset string => Digit -> string
+ ASCII: hexCharString :: HexStringSuperset string => HexChar -> string
Files
- ascii.cabal +1/−1
- library/ASCII.hs +18/−0
- test/Main.hs +14/−0
ascii.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0 name: ascii-version: 1.1.2.0+version: 1.1.3.0 synopsis: The ASCII character set and encoding category: Data, Text
library/ASCII.hs view
@@ -67,6 +67,8 @@ {- ** Natural strings -} showNaturalDecimal, showNaturalHexadecimal, readNaturalDecimal, readNaturalHexadecimal,+ {- ** Single-digit strings -}+ digitString, hexCharString, {- * Classes -} {- ** Supersets of ASCII -} CharSuperset, StringSuperset, Lift,@@ -710,3 +712,19 @@ readNaturalHexChars :: [HexChar] -> Maybe Natural readNaturalHexChars = readNaturalHexadecimal++{- |++A string containing a single digit character 0-9++-}+digitString :: DigitStringSuperset string => Digit -> string+digitString x = ASCII.Decimal.fromDigitList [x]++{- |++A string containing a single hexadecimal digit character 0-9, A-F, or a-f.++-}+hexCharString :: HexStringSuperset string => HexChar -> string+hexCharString x = ASCII.Hexadecimal.fromHexCharList [x]
test/Main.hs view
@@ -13,6 +13,7 @@ import Data.Maybe (Maybe (..)) import Data.Text (Text) import Data.Word (Word8)+import Prelude (enumFromTo, maxBound, minBound) import System.Exit (exitFailure) import System.IO (IO) @@ -105,3 +106,16 @@ prop_bytes_to_string_fail :: Property prop_bytes_to_string_fail = withTests 1 $ property $ ASCII.byteListToUnicodeStringMaybe [0x48, 0x54, 0x54, 0x80] === Nothing++prop_digitStrings :: Property+prop_digitStrings = withTests 1 $ property $+ map digitString (enumFromTo minBound maxBound) ===+ (["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] :: [Text])++prop_hexCharStrings :: Property+prop_hexCharStrings = withTests 1 $ property $+ map hexCharString (enumFromTo minBound maxBound) ===+ ( [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"+ , "A", "B", "C", "D", "E", "F"+ , "a", "b", "c", "d", "e", "f"+ ] :: [Text] )