Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
ASCII characters are broadly categorized into two groups: control codes and printable characters.
The Group
type
Control | 33 of the ASCII characters are control codes. A few of these are still in use, but most are obsolete relics of the early days of computing. |
Printable | 95 of the ASCII characters are printable characters such as letters and numbers, mostly corresponding to the keys on an American English keyboard. |
Instances
Data Group Source # | |
Defined in ASCII.Group gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Group -> c Group # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Group # dataTypeOf :: Group -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Group) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Group) # gmapT :: (forall b. Data b => b -> b) -> Group -> Group # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Group -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Group -> r # gmapQ :: (forall d. Data d => d -> u) -> Group -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Group -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Group -> m Group # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Group -> m Group # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Group -> m Group # | |
Bounded Group Source # | |
Enum Group Source # | |
Generic Group Source # | |
Show Group Source # | |
Eq Group Source # | |
Ord Group Source # | |
Hashable Group Source # | |
Defined in ASCII.Group | |
type Rep Group Source # | |
Functions
charGroup :: Char -> Group Source #
Determine which group a particular character belongs to
>>>
map charGroup [CapitalLetterA,EndOfTransmission]
[Printable,Control]
inGroup :: Group -> Char -> Bool Source #
Test whether a character belongs to a particular group
>>>
inGroup Printable EndOfTransmission
False
>>>
inGroup Control EndOfTransmission
True
Notes
Space is a printable character (perhaps surprisingly, given that it is invisible).
>>>
charGroup Space
Printable
Tab is a control code (perhaps surprisingly, given that space is a printable character).
>>>
charGroup HorizontalTab
Control
A few examples of printable characters:
>>>
all (inGroup Printable) [CapitalLetterA,SmallLetterZ,Digit4,Tilde]
True
A few examples of control characters:
>>>
all (inGroup Control) [Null,Substitute,UnitSeparator,Delete]
True
There are 33 control codes.
>>>
length (filter (inGroup Control) allCharacters)
33
There are 95 printable characters.
>>>
length (filter (inGroup Printable) allCharacters)
95