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 |

Printable | 95 of the ASCII characters are |

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

`>>>`

[Printable,Control]`map charGroup [CapitalLetterA,EndOfTransmission]`

inGroup :: Group -> Char -> Bool Source #

Test whether a character belongs to a particular group

`>>>`

False`inGroup Printable EndOfTransmission`

`>>>`

True`inGroup Control EndOfTransmission`

# Notes

Space is a printable character (perhaps surprisingly, given that it is invisible).

`>>>`

Printable`charGroup Space`

Tab is a control code (perhaps surprisingly, given that space is a printable character).

`>>>`

Control`charGroup HorizontalTab`

A few examples of printable characters:

`>>>`

True`all (inGroup Printable) [CapitalLetterA,SmallLetterZ,Digit4,Tilde]`

A few examples of control characters:

`>>>`

True`all (inGroup Control) [Null,Substitute,UnitSeparator,Delete]`

There are 33 control codes.

`>>>`

33`length (filter (inGroup Control) allCharacters)`

There are 95 printable characters.

`>>>`

95`length (filter (inGroup Printable) allCharacters)`