HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleparsec1-1.0.0.8Haskell98

Text.ParserCombinators.Parsec.Char

Commonly used character parsers

Synopsis
  • 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 ';' 

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) 

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

 divOrMod    =   string "div"
             <|> string "mod"