ascii-predicates-1.0.0.8: Various categorizations of ASCII characters
Safe HaskellSafe-Inferred
LanguageHaskell2010

ASCII.Predicates

Synopsis

Group predicates

isControl :: Char -> Bool Source #

Returns True for control characters.

This function is analogous to isControl in the Data.Char module.

isPrint :: Char -> Bool Source #

Returns True for printable characters.

This function is analogous to isPrint in the Data.Char module.

Case predicates

isLower :: Char -> Bool Source #

Returns True for lower-case letters, from SmallLetterA to SmallLetterZ.

This function is analogous to isLower in the Data.Char module.

isUpper :: Char -> Bool Source #

Returns True for upper-case letters, from CapitalLetterA to CapitalLetterZ.

This function is analogous to isUpper in the Data.Char module.

Letter predicates

isLetter :: Char -> Bool Source #

Returns True for letters:

This function is analogous to isLetter in the Data.Char module.

isAlpha :: Char -> Bool Source #

Synonym for isLetter.

This function is analogous to isAlpha in the Data.Char module.

Number predicates

isDigit :: Char -> Bool Source #

Returns True for the characters from Digit0 to Digit9.

This function is analogous to isDigit in the Data.Char module.

isOctDigit :: Char -> Bool Source #

Returns True for the characters from Digit0 to Digit7.

This function is analogous to isOctDigit in the Data.Char module.

isHexDigit :: Char -> Bool Source #

Returns True for characters in any of the following ranges:

This function is analogous to isHexDigit in the Data.Char module.

isNumber :: Char -> Bool Source #

Synonym for isDigit.

In the Data.Char module, isDigit selects only the ASCII digits 0 through 9, and isNumber selects a wider set of characters because the full Unicode character set contains more numeric characters than just the ASCII digits. In this module, these two functions are redundant, but we include this synonym for compatibility with Data.Char.

Miscellaneous predicates

isSpace :: Char -> Bool Source #

Returns True for the following characters:

This function is analogous to isSpace in the Data.Char module.

isAlphaNum :: Char -> Bool Source #

This function is analogous to isAlphaNum in the Data.Char module.

isMark :: Char -> Bool Source #

Selects mark characters, for example accents and the like, which combine with preceding characters. This always returns False because ASCII does not include any mark characters. This function is included only for compatibility with isMark in the Data.Char module.

isSymbol :: Char -> Bool Source #

Returns True for the following characters:

This function is analogous to isSymbol in the Data.Char module.

isSeparator :: Char -> Bool Source #

Returns True if the character is Space.

This function is analogous to isSeparator in the Data.Char module.

Notes

This module defines drop-in replacements for closely related definitions of the same name in the Data.Char module.

>>> import qualified Data.Char
>>> import qualified Data.List
>>> convert = Data.Char.chr . ASCII.Char.toInt
>>> eq f g = Data.List.all (\x -> f x == g (convert x)) ASCII.Char.allCharacters
>>> eq isControl Data.Char.isControl
True
>>> eq isSpace Data.Char.isSpace
True
>>> eq isLower Data.Char.isLower
True
>>> eq isUpper Data.Char.isUpper
True
>>> eq isAlpha Data.Char.isAlpha
True
>>> eq isAlphaNum Data.Char.isAlphaNum
True
>>> eq isPrint Data.Char.isPrint
True
>>> eq isDigit Data.Char.isDigit
True
>>> eq isOctDigit Data.Char.isOctDigit
True
>>> eq isHexDigit Data.Char.isHexDigit
True
>>> eq isLetter Data.Char.isLetter
True
>>> eq isMark Data.Char.isMark
True
>>> eq isNumber Data.Char.isNumber
True
>>> eq isPunctuation Data.Char.isPunctuation
True
>>> eq isSymbol Data.Char.isSymbol
True
>>> eq isSeparator Data.Char.isSeparator
True