HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleparsec1-1.0.0.8Haskell98

Text.ParserCombinators.Parsec.Char

Commonly used character parsers

  • 1 type
  • 17 values
  • Packageparsec1-1.0.0.8
  • Exports18
  • LanguageHaskell98
  • LicenceBSD-3-Clause
  • SourceChar.hs
valuechar :: Char -> CharParser st Char
#

char c parses a single character c. Returns the parsed character (i.e. c).

 semiColon  = char ';' 
valuehexDigit :: CharParser st Char
#

Parses a hexadecimal digit (a digit or a letter between 'a' and 'f' or 'A' and 'F'). Returns the parsed character.

valuenoneOf :: [Char] -> CharParser st Char
#

As the dual of oneOf, noneOf cs succeeds if the current character not in the supplied list of characters cs. Returns the parsed character.

 consonant = noneOf "aeiou" 
valueoneOf :: [Char] -> CharParser st Char
#

oneOf cs succeeds if the current character is in the supplied list of characters cs. Returns the parsed character. See also satisfy.

  vowel  = oneOf "aeiou" 
valuesatisfy :: (Char -> Bool) -> CharParser st Char
#

The parser satisfy f succeeds for any character for which the supplied function f returns True. Returns the character that is actually parsed.

 digit     = satisfy isDigit
 oneOf cs  = satisfy (`elem` cs) 
valuespace :: CharParser st Char
#

Parses a white space character (any character which satisfies isSpace) Returns the parsed character.

valuestring :: String -> CharParser st String
#

string s parses a sequence of characters given by s. Returns the parsed string (i.e. s).

 divOrMod    =   string "div"
             <|> string "mod" 
valuetab :: CharParser st Char
#

Parses a tab character ('\t'). Returns a tab character.