rio-0.1.22.0: A standard library for Haskell

Safe Haskell | Safe-Inferred
Language | Haskell2010

RIO.Char

Contents

- Character classification
  - Subranges
  - Unicode general categories
- Case conversion
- Numeric representations
- String representations

Description

Unicode `Char`. Import as:

    import qualified RIO.Char as C

This module does not export any partial functions. For those, see RIO.Char.Partial

Synopsis

- data Char
- isControl :: Char -> Bool
- isSpace :: Char -> Bool
- isLower :: Char -> Bool
- isUpper :: Char -> Bool
- isAlpha :: Char -> Bool
- isAlphaNum :: Char -> Bool
- isPrint :: Char -> Bool
- isDigit :: Char -> Bool
- isOctDigit :: Char -> Bool
- isHexDigit :: Char -> Bool
- isLetter :: Char -> Bool
- isMark :: Char -> Bool
- isNumber :: Char -> Bool
- isPunctuation :: Char -> Bool
- isSymbol :: Char -> Bool
- isSeparator :: Char -> Bool
- isAscii :: Char -> Bool
- isLatin1 :: Char -> Bool
- isAsciiUpper :: Char -> Bool
- isAsciiLower :: Char -> Bool
- data GeneralCategory
  - = UppercaseLetter
  - | LowercaseLetter
  - | TitlecaseLetter
  - | ModifierLetter
  - | OtherLetter
  - | NonSpacingMark
  - | SpacingCombiningMark
  - | EnclosingMark
  - | DecimalNumber
  - | LetterNumber
  - | OtherNumber
  - | ConnectorPunctuation
  - | DashPunctuation
  - | OpenPunctuation
  - | ClosePunctuation
  - | InitialQuote
  - | FinalQuote
  - | OtherPunctuation
  - | MathSymbol
  - | CurrencySymbol
  - | ModifierSymbol
  - | OtherSymbol
  - | Space
  - | LineSeparator
  - | ParagraphSeparator
  - | Control
  - | Format
  - | Surrogate
  - | PrivateUse
  - | NotAssigned
- generalCategory :: Char -> GeneralCategory
- toUpper :: Char -> Char
- toLower :: Char -> Char
- toTitle :: Char -> Char
- ord :: Char -> Int
- showLitChar :: Char -> ShowS
- lexLitChar :: ReadS String
- readLitChar :: ReadS Char

# Documentation

data Char #

#### Instances

Instances details

Data Char |

Instance details

Defined in Data.Data

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Char -> c Char #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Char #

toConstr :: Char -> Constr #

dataTypeOf :: Char -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Char) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Char) #

gmapT :: (forall b. Data b => b -> b) -> Char -> Char #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Char -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Char -> r #

gmapQ :: (forall d. Data d => d -> u) -> Char -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Char -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Char -> m Char #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Char -> m Char #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Char -> m Char #

Storable Char |
Instance details Defined in Foreign.Storable Methods sizeOf :: Char -> Int # alignment :: Char -> Int # peekElemOff :: Ptr Char -> Int -> IO Char # pokeElemOff :: Ptr Char -> Int -> Char -> IO () # peekByteOff :: Ptr b -> Int -> IO Char # pokeByteOff :: Ptr b -> Int -> Char -> IO () # peek :: Ptr Char -> IO Char # poke :: Ptr Char -> Char -> IO () #
Bounded Char |
Instance details Defined in GHC.Enum Methods minBound :: Char # maxBound :: Char #
Enum Char |
Instance details Defined in GHC.Enum Methods succ :: Char -> Char # pred :: Char -> Char # toEnum :: Int -> Char # fromEnum :: Char -> Int # enumFrom :: Char -> [Char] enumFromThen :: Char -> Char -> [Char] enumFromTo :: Char -> Char -> [Char] enumFromThenTo :: Char -> Char -> Char -> [Char]
Ix Char |
Instance details Defined in GHC.Ix Methods range :: (Char, Char) -> [Char] index :: (Char, Char) -> Char -> Int unsafeIndex :: (Char, Char) -> Char -> Int inRange :: (Char, Char) -> Char -> Bool rangeSize :: (Char, Char) -> Int unsafeRangeSize :: (Char, Char) -> Int
Read Char |
Instance details Defined in GHC.Read Methods readsPrec :: Int -> ReadS Char readList :: ReadS [Char] readPrec :: ReadPrec Char readListPrec :: ReadPrec [Char]
Show Char |
Instance details Defined in GHC.Show Methods showsPrec :: Int -> Char -> ShowS show :: Char -> String # showList :: [Char] -> ShowS
NFData Char |
Instance details Defined in Control.DeepSeq Methods rnf :: Char -> () #
Eq Char |
Instance details Defined in GHC.Classes Methods (==) :: Char -> Char -> Bool # (/=) :: Char -> Char -> Bool #
Ord Char |
Instance details Defined in GHC.Classes Methods compare :: Char -> Char -> Ordering # (<) :: Char -> Char -> Bool # (<=) :: Char -> Char -> Bool # (>) :: Char -> Char -> Bool # (>=) :: Char -> Char -> Bool # max :: Char -> Char -> Char # min :: Char -> Char -> Char #
Hashable Char |
Instance details Defined in Data.Hashable.Class Methods hashWithSalt :: Int -> Char -> Int # hash :: Char -> Int #
Display Char # | Since: 0.1.0.0
Instance details Defined in RIO.Prelude.Display Methods display :: Char -> Utf8Builder # textDisplay :: Char -> Text #
Unbox Char |
Instance details Defined in Data.Vector.Unboxed.Base
Lift Char |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Char -> m Exp liftTyped :: forall (m :: Type -> Type). Quote m => Char -> Code m Char
Vector Vector Char |

Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicUnsafeFreeze :: Mutable Vector s Char -> ST s (Vector Char) #

basicUnsafeThaw :: Vector Char -> ST s (Mutable Vector s Char) #

basicLength :: Vector Char -> Int #

basicUnsafeSlice :: Int -> Int -> Vector Char -> Vector Char #

basicUnsafeIndexM :: Vector Char -> Int -> Box Char #

basicUnsafeCopy :: Mutable Vector s Char -> Vector Char -> ST s () #

elemseq :: Vector Char -> Char -> b -> b #

MVector MVector Char |

Instance details

Defined in Data.Vector.Unboxed.Base

Methods

basicLength :: MVector s Char -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s Char -> MVector s Char #

basicOverlaps :: MVector s Char -> MVector s Char -> Bool #

basicUnsafeNew :: Int -> ST s (MVector s Char) #

basicInitialize :: MVector s Char -> ST s () #

basicUnsafeReplicate :: Int -> Char -> ST s (MVector s Char) #

basicUnsafeRead :: MVector s Char -> Int -> ST s Char #

basicUnsafeWrite :: MVector s Char -> Int -> Char -> ST s () #

basicClear :: MVector s Char -> ST s () #

basicSet :: MVector s Char -> Char -> ST s () #

basicUnsafeCopy :: MVector s Char -> MVector s Char -> ST s () #

basicUnsafeMove :: MVector s Char -> MVector s Char -> ST s () #

basicUnsafeGrow :: MVector s Char -> Int -> ST s (MVector s Char) #

Generic1 (URec Char :: k -> Type) |
Instance details Defined in GHC.Generics Associated Types type Rep1 (URec Char) :: k -> Type Methods from1 :: forall (a :: k0). URec Char a -> Rep1 (URec Char) a to1 :: forall (a :: k0). Rep1 (URec Char) a -> URec Char a
Foldable (UChar :: Type -> Type) |

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => UChar m -> m #

foldMap :: Monoid m => (a -> m) -> UChar a -> m #

foldMap' :: Monoid m => (a -> m) -> UChar a -> m

foldr :: (a -> b -> b) -> b -> UChar a -> b #

foldr' :: (a -> b -> b) -> b -> UChar a -> b

foldl :: (b -> a -> b) -> b -> UChar a -> b #

foldl' :: (b -> a -> b) -> b -> UChar a -> b #

foldr1 :: (a -> a -> a) -> UChar a -> a #

foldl1 :: (a -> a -> a) -> UChar a -> a #

toList :: UChar a -> [a] #

null :: UChar a -> Bool #

length :: UChar a -> Int #

elem :: Eq a => a -> UChar a -> Bool #

maximum :: Ord a => UChar a -> a #

minimum :: Ord a => UChar a -> a #

sum :: Num a => UChar a -> a #

product :: Num a => UChar a -> a #

Traversable (UChar :: Type -> Type) |
Instance details Defined in Data.Traversable Methods traverse :: Applicative f => (a -> f b) -> UChar a -> f (UChar b) # sequenceA :: Applicative f => UChar (f a) -> f (UChar a) # mapM :: Monad m => (a -> m b) -> UChar a -> m (UChar b) # sequence :: Monad m => UChar (m a) -> m (UChar a) #
Functor (URec Char :: Type -> Type) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> URec Char a -> URec Char b # (<$) :: a -> URec Char b -> URec Char a #
Generic (URec Char p) |
Instance details Defined in GHC.Generics Associated Types type Rep (URec Char p) :: Type -> Type Methods from :: URec Char p -> Rep (URec Char p) x to :: Rep (URec Char p) x -> URec Char p
Show (URec Char p) |
Instance details Defined in GHC.Generics Methods showsPrec :: Int -> URec Char p -> ShowS show :: URec Char p -> String # showList :: [URec Char p] -> ShowS
Eq (URec Char p) |
Instance details Defined in GHC.Generics Methods (==) :: URec Char p -> URec Char p -> Bool # (/=) :: URec Char p -> URec Char p -> Bool #
Ord (URec Char p) |
Instance details Defined in GHC.Generics Methods compare :: URec Char p -> URec Char p -> Ordering # (<) :: URec Char p -> URec Char p -> Bool # (<=) :: URec Char p -> URec Char p -> Bool # (>) :: URec Char p -> URec Char p -> Bool # (>=) :: URec Char p -> URec Char p -> Bool # max :: URec Char p -> URec Char p -> URec Char p # min :: URec Char p -> URec Char p -> URec Char p #
newtype Vector Char |
Instance details Defined in Data.Vector.Unboxed.Base newtype Vector Char = V_Char (Vector Char)
data URec Char (p :: k) |

Instance details

Defined in GHC.Generics

data URec Char (p :: k) = UChar {

- uChar# :: Char#

}

newtype MVector s Char |
Instance details Defined in Data.Vector.Unboxed.Base newtype MVector s Char = MV_Char (MVector s Char)
type Compare (a :: Char) (b :: Char) |
Instance details Defined in Data.Type.Ord type Compare (a :: Char) (b :: Char) = CmpChar a b
type Rep1 (URec Char :: k -> Type) |
Instance details Defined in GHC.Generics type Rep1 (URec Char :: k -> Type) = D1 ('MetaData "URec" "GHC.Generics" "base" 'False) (C1 ('MetaCons "UChar" 'PrefixI 'True) (S1 ('MetaSel ('Just "uChar#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (UChar :: k -> Type)))
type Rep (URec Char p) |
Instance details Defined in GHC.Generics type Rep (URec Char p) = D1 ('MetaData "URec" "GHC.Generics" "base" 'False) (C1 ('MetaCons "UChar" 'PrefixI 'True) (S1 ('MetaSel ('Just "uChar#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (UChar :: Type -> Type)))

# Character classification

Unicode characters are divided into letters, Data.Char.numbers, marks, punctuation, Data.Char.symbols, separators (including spaces) and others (including control characters).

isControl :: Char -> Bool #

isSpace :: Char -> Bool #

isLower :: Char -> Bool #

isUpper :: Char -> Bool #

isAlpha :: Char -> Bool #

isAlphaNum :: Char -> Bool #

isPrint :: Char -> Bool #

isDigit :: Char -> Bool #

isOctDigit :: Char -> Bool #

isHexDigit :: Char -> Bool #

isLetter :: Char -> Bool #

isMark :: Char -> Bool #

isNumber :: Char -> Bool #

isPunctuation :: Char -> Bool #

isSymbol :: Char -> Bool #

isSeparator :: Char -> Bool #

## Subranges

isAscii :: Char -> Bool #

isLatin1 :: Char -> Bool #

isAsciiUpper :: Char -> Bool #

isAsciiLower :: Char -> Bool #

## Unicode general categories

data GeneralCategory #

Constructors

UppercaseLetter |
LowercaseLetter |
TitlecaseLetter |
ModifierLetter |
OtherLetter |
NonSpacingMark |
SpacingCombiningMark |
EnclosingMark |
DecimalNumber |
LetterNumber |
OtherNumber |
ConnectorPunctuation |
DashPunctuation |
OpenPunctuation |
ClosePunctuation |
InitialQuote |
FinalQuote |
OtherPunctuation |
MathSymbol |
CurrencySymbol |
ModifierSymbol |
OtherSymbol |
Space |
LineSeparator |
ParagraphSeparator |
Control |
Format |
Surrogate |
PrivateUse |
NotAssigned |

#### Instances

Instances details

Bounded GeneralCategory |
Instance details Defined in GHC.Unicode Methods minBound :: GeneralCategory # maxBound :: GeneralCategory #
Enum GeneralCategory |

Instance details

Defined in GHC.Unicode

Methods

succ :: GeneralCategory -> GeneralCategory #

pred :: GeneralCategory -> GeneralCategory #

toEnum :: Int -> GeneralCategory #

fromEnum :: GeneralCategory -> Int #

enumFrom :: GeneralCategory -> [GeneralCategory]

enumFromThen :: GeneralCategory -> GeneralCategory -> [GeneralCategory]

enumFromTo :: GeneralCategory -> GeneralCategory -> [GeneralCategory]

enumFromThenTo :: GeneralCategory -> GeneralCategory -> GeneralCategory -> [GeneralCategory]

Generic GeneralCategory |
Instance details Defined in GHC.Generics Associated Types type Rep GeneralCategory :: Type -> Type Methods from :: GeneralCategory -> Rep GeneralCategory x to :: Rep GeneralCategory x -> GeneralCategory
Ix GeneralCategory |

Instance details

Defined in GHC.Unicode

Methods

range :: (GeneralCategory, GeneralCategory) -> [GeneralCategory]

index :: (GeneralCategory, GeneralCategory) -> GeneralCategory -> Int

unsafeIndex :: (GeneralCategory, GeneralCategory) -> GeneralCategory -> Int

inRange :: (GeneralCategory, GeneralCategory) -> GeneralCategory -> Bool

rangeSize :: (GeneralCategory, GeneralCategory) -> Int

unsafeRangeSize :: (GeneralCategory, GeneralCategory) -> Int

Read GeneralCategory |
Instance details Defined in GHC.Read Methods readsPrec :: Int -> ReadS GeneralCategory readList :: ReadS [GeneralCategory] readPrec :: ReadPrec GeneralCategory readListPrec :: ReadPrec [GeneralCategory]
Show GeneralCategory |
Instance details Defined in GHC.Unicode Methods showsPrec :: Int -> GeneralCategory -> ShowS show :: GeneralCategory -> String # showList :: [GeneralCategory] -> ShowS
Eq GeneralCategory |
Instance details Defined in GHC.Unicode Methods (==) :: GeneralCategory -> GeneralCategory -> Bool # (/=) :: GeneralCategory -> GeneralCategory -> Bool #
Ord GeneralCategory |

Instance details

Defined in GHC.Unicode

Methods

compare :: GeneralCategory -> GeneralCategory -> Ordering #

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

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

(>) :: GeneralCategory -> GeneralCategory -> Bool #

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

max :: GeneralCategory -> GeneralCategory -> GeneralCategory #

min :: GeneralCategory -> GeneralCategory -> GeneralCategory #

type Rep GeneralCategory |

Instance details

Defined in GHC.Generics

type Rep GeneralCategory = D1 ('MetaData "GeneralCategory" "GHC.Unicode" "base" 'False) ((((C1 ('MetaCons "UppercaseLetter" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "LowercaseLetter" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TitlecaseLetter" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ModifierLetter" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OtherLetter" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NonSpacingMark" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SpacingCombiningMark" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: (((C1 ('MetaCons "EnclosingMark" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DecimalNumber" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "LetterNumber" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OtherNumber" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ConnectorPunctuation" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DashPunctuation" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "OpenPunctuation" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ClosePunctuation" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "InitialQuote" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "FinalQuote" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OtherPunctuation" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "MathSymbol" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CurrencySymbol" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ModifierSymbol" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OtherSymbol" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: (((C1 ('MetaCons "Space" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LineSeparator" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ParagraphSeparator" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Control" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "Format" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Surrogate" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PrivateUse" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NotAssigned" 'PrefixI 'False) (U1 :: Type -> Type))))))

generalCategory :: Char -> GeneralCategory #

# Case conversion

toUpper :: Char -> Char #

toLower :: Char -> Char #

toTitle :: Char -> Char #

# Numeric representations

ord :: Char -> Int #

# String representations

showLitChar :: Char -> ShowS #

lexLitChar :: ReadS String #

readLitChar :: ReadS Char #