Prelude.Chars: add isControl function
This function tests whether a character is a Unicode control character,
as specified in ISO 6429.
commit72937bbe5155ed3a60e9fd55b95b36a4b966c4e1
authorMichael Morgan <morgan.michael@me.com>
dateMon 4 Dec 2017, 11:38 (9 years ago)
parenta2e981e
libs/prelude/Prelude/Chars.idr+5
@@ -81,3 +81,8 @@ isHexDigit x = elem (toUpper x) hexChars where
8181||| Returns true if the character is an octal digit.
8282isOctDigit : Char -> Bool
8383isOctDigit x = (x >= '0' && x <= '7')
84+
85+||| Returns true if the character is a control character.
86+isControl : Char -> Bool
87+isControl x = (x >= '\x0000' && x <= '\x001f')
88+ || (x >= '\x007f' && x <= '\x009f')