ascii-group-1.0.0.17: ASCII character groups
Safe HaskellSafe-Inferred
LanguageGHC2021

ASCII.Group

Description

ASCII characters are broadly categorized into two groups: control codes and printable characters.

Synopsis

The Group type

data Group Source #

Constructors

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

Instances details
Data Group Source # 
Instance details

Defined in ASCII.Group

Methods

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 #

toConstr :: Group -> Constr #

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 # 
Instance details

Defined in ASCII.Group

Enum Group Source # 
Instance details

Defined in ASCII.Group

Generic Group Source # 
Instance details

Defined in ASCII.Group

Associated Types

type Rep Group :: Type -> Type #

Methods

from :: Group -> Rep Group x #

to :: Rep Group x -> Group #

Show Group Source # 
Instance details

Defined in ASCII.Group

Methods

showsPrec :: Int -> Group -> ShowS #

show :: Group -> String #

showList :: [Group] -> ShowS #

Eq Group Source # 
Instance details

Defined in ASCII.Group

Methods

(==) :: Group -> Group -> Bool #

(/=) :: Group -> Group -> Bool #

Ord Group Source # 
Instance details

Defined in ASCII.Group

Methods

compare :: Group -> Group -> Ordering #

(<) :: Group -> Group -> Bool #

(<=) :: Group -> Group -> Bool #

(>) :: Group -> Group -> Bool #

(>=) :: Group -> Group -> Bool #

max :: Group -> Group -> Group #

min :: Group -> Group -> Group #

Hashable Group Source # 
Instance details

Defined in ASCII.Group

Methods

hashWithSalt :: Int -> Group -> Int #

hash :: Group -> Int #

type Rep Group Source # 
Instance details

Defined in ASCII.Group

type Rep Group = D1 ('MetaData "Group" "ASCII.Group" "ascii-group-1.0.0.17-K9v7b6U1k678BEEnuptA5s" 'False) (C1 ('MetaCons "Control" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Printable" 'PrefixI 'False) (U1 :: Type -> Type))

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