HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

ModuleCabal-syntax-3.12.1.0Haskell2010

Distribution.Compat.CharParsing

Parsers for character streams

Originally in parsers package.

  • 1 class
  • 19 values

Combinators

14 declarations
valueoneOf :: CharParsing m => [Char] -> m 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"
valuenoneOf :: CharParsing m => [Char] -> m Char
#

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

 consonant = noneOf "aeiou"
valuespace :: CharParsing m => m Char
#

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

valuetab :: CharParsing m => m Char
#

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

valueletter :: CharParsing m => m Char
#

Parses a letter (an upper case or lower case character). Returns the parsed character.

valuehexDigit :: CharParsing m => m Char
#

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

valueoctDigit :: CharParsing m => m Char
#

Parses an octal digit (a character between '0' and '7'). Returns the parsed character.

Class

1 declaration
classclass Parsing m => CharParsing (m :: Type -> Type) where
#

Additional functionality needed to parse character streams.

Methods

  • satisfy :: (Char -> Bool) -> m Char

    Parse a single character of the input, with UTF-8 decoding

  • char :: Char -> m Char

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

    e.g.

    semiColon = char ';'
  • notChar :: Char -> m Char

    notChar c parses any single character other than c. Returns the parsed character.

  • anyChar :: m Char

    This parser succeeds for any character. Returns the parsed character.

  • string :: String -> m String

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

     divOrMod    =   string "div"
                 <|> string "mod"
  • text :: Text -> m Text

    text t parses a sequence of characters determined by the text t Returns the parsed text fragment (i.e. t).

    Using OverloadedStrings:

     divOrMod    =   text "div"
                 <|> text "mod"
Instances10CharParsing, …

Cabal additions

5 declarations