packages feed

ascii-predicates 1.0.0.10 → 1.0.1.0

raw patch · 5 files changed

+39/−7 lines, 5 filesdep ~basedep ~hedgehogPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, hedgehog

API changes (from Hackage documentation)

+ ASCII.Lists: visibleCharacters :: [Char]
+ ASCII.Predicates: isVisible :: Char -> Bool

Files

ascii-predicates.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0  name: ascii-predicates-version: 1.0.0.10+version: 1.0.1.0 synopsis: Various categorizations of ASCII characters category: Data, Text @@ -33,7 +33,7 @@      build-depends:         ascii-char ^>= 1.0-      , base >= 4.11 && < 4.17+      , base >= 4.13 && < 4.17  library     import: base@@ -57,4 +57,4 @@      build-depends:         ascii-predicates-      , hedgehog ^>= 1.0 || ^>= 1.1+      , hedgehog ^>= 1.0.1 || ^>= 1.1
library/ASCII/Lists.hs view
@@ -4,7 +4,8 @@     {- ** Every character -} all,     {- ** Group-related -} printableCharacters, controlCodes,     {- ** Letter-related -} letters, capitalLetters, smallLetters,-    {- ** Number-related -} digits, octDigits, hexDigits, numbers+    {- ** Number-related -} digits, octDigits, hexDigits, numbers,+    {- ** Other -} visibleCharacters,     {- * Notes -} {- $notes -}   )   where@@ -22,6 +23,11 @@  printableCharacters :: [Char] printableCharacters = enumFromTo Space Tilde++-- | Characters drawable with ink on a page: 'ExclamationMark', 'QuotationMark', 'NumberSign', 'DollarSign', 'PercentSign', 'Ampersand', 'Apostrophe', 'LeftParenthesis', 'RightParenthesis', 'Asterisk', 'PlusSign', 'Comma', 'HyphenMinus', 'FullStop', 'Slash', 'Digit0', 'Digit1', 'Digit2', 'Digit3', 'Digit4', 'Digit5', 'Digit6', 'Digit7', 'Digit8', 'Digit9', 'Colon', 'Semicolon', 'LessThanSign', 'EqualsSign', 'GreaterThanSign', 'QuestionMark', 'AtSign', 'CapitalLetterA', 'CapitalLetterB', 'CapitalLetterC', 'CapitalLetterD', 'CapitalLetterE', 'CapitalLetterF', 'CapitalLetterG', 'CapitalLetterH', 'CapitalLetterI', 'CapitalLetterJ', 'CapitalLetterK', 'CapitalLetterL', 'CapitalLetterM', 'CapitalLetterN', 'CapitalLetterO', 'CapitalLetterP', 'CapitalLetterQ', 'CapitalLetterR', 'CapitalLetterS', 'CapitalLetterT', 'CapitalLetterU', 'CapitalLetterV', 'CapitalLetterW', 'CapitalLetterX', 'CapitalLetterY', 'CapitalLetterZ', 'LeftSquareBracket', 'Backslash', 'RightSquareBracket', 'Caret', 'Underscore', 'GraveAccent', 'SmallLetterA', 'SmallLetterB', 'SmallLetterC', 'SmallLetterD', 'SmallLetterE', 'SmallLetterF', 'SmallLetterG', 'SmallLetterH', 'SmallLetterI', 'SmallLetterJ', 'SmallLetterK', 'SmallLetterL', 'SmallLetterM', 'SmallLetterN', 'SmallLetterO', 'SmallLetterP', 'SmallLetterQ', 'SmallLetterR', 'SmallLetterS', 'SmallLetterT', 'SmallLetterU', 'SmallLetterV', 'SmallLetterW', 'SmallLetterX', 'SmallLetterY', 'SmallLetterZ', 'LeftCurlyBracket', 'VerticalLine', 'RightCurlyBracket', 'Tilde'.++visibleCharacters :: [Char]+visibleCharacters = enumFromTo ExclamationMark Tilde  -- | Characters in the 'Control' group: 'Null', 'StartOfHeading', 'StartOfText', 'EndOfText', 'EndOfTransmission', 'Enquiry', 'Acknowledgement', 'Bell', 'Backspace', 'HorizontalTab', 'LineFeed', 'VerticalTab', 'FormFeed', 'CarriageReturn', 'ShiftOut', 'ShiftIn', 'DataLinkEscape', 'DeviceControl1', 'DeviceControl2', 'DeviceControl3', 'DeviceControl4', 'NegativeAcknowledgement', 'SynchronousIdle', 'EndOfTransmissionBlock', 'Cancel', 'EndOfMedium', 'Substitute', 'Escape', 'FileSeparator', 'GroupSeparator', 'RecordSeparator', 'UnitSeparator', 'Delete'. 
library/ASCII/ListsAndPredicates.hs view
@@ -44,4 +44,7 @@ >>> hexDigits == filter isHexDigit all True +>>> visibleCharacters == filter isVisible all+True+ -}
library/ASCII/Predicates.hs view
@@ -4,7 +4,7 @@     {- * Case predicates -} isLower, isUpper,     {- * Letter predicates -} isLetter, isAlpha,     {- * Number predicates -} isDigit, isOctDigit, isHexDigit, isNumber,-    {- * Miscellaneous predicates -} isSpace, isAlphaNum, isMark, isPunctuation, isSymbol, isSeparator+    {- * Miscellaneous predicates -} isSpace, isAlphaNum, isMark, isPunctuation, isSymbol, isSeparator, isVisible,     {- * Notes -} {- $notes -}   )   where@@ -26,7 +26,7 @@ -}  isControl :: Char -> Bool-isControl x  =+isControl x =     case x of         _ | (x < Char.Space) -> True         Char.Delete          -> True@@ -40,6 +40,19 @@  isPrint :: Char -> Bool isPrint = Bool.not . isControl++{- | Returns True for visible characters.++This includes all print characters except 'Char.Space'.++-}++isVisible :: Char -> Bool+isVisible x =+    case x of+        _ | x <= Char.Space -> False+        Char.Delete         -> False+        _                   -> True  {- | Returns True for lower-case letters, from 'SmallLetterA' to 'SmallLetterZ'. 
test/Main.hs view
@@ -23,10 +23,12 @@  --- +-- This test ensures that all of the lists give characters in ascending order.+ lists :: [[ASCII.Char.Char]] lists = [ all, printableCharacters, controlCodes, letters,           capitalLetters, smallLetters, digits, octDigits,-          hexDigits, numbers ]+          hexDigits, numbers, visibleCharacters ]  prop_lists_are_sorted :: Property prop_lists_are_sorted = withTests 1 $ property $@@ -34,6 +36,8 @@  --- +-- These tests check that the predicates in our package that have corresponding functions in `base` behave the same as their counterparts.+ eq :: (MonadTest m, Eq a) => (ASCII.Char.Char -> a) -> (Char.Char -> a) -> m () eq f g = assert $ List.all (\x -> f x == g (convert x)) ASCII.Char.allCharacters   where@@ -105,6 +109,8 @@  --- +-- These tests ensure that the predicates are coherent with the lists.+ prop_list_control :: Property prop_list_control = withTests 1 $ property $     controlCodes === filter isControl all@@ -140,3 +146,7 @@ prop_list_hex :: Property prop_list_hex = withTests 1 $ property $     hexDigits === filter isHexDigit all++prop_list_visible :: Property+prop_list_visible = withTests 1 $ property $+    visibleCharacters === filter isVisible all