HORIZON HASKELLDocslts/ghc-10.0.x04404a62026-10-19Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 04404a6 · 2026-10-19

ModuleCabal-syntax-3.18.1.0Haskell2010

Distribution.Compat.CharParsing

Parsers for character streams

Originally in parsers package.

Contents
  1. Combinators
  2. Class
  3. Cabal additions
Synopsis

Combinators

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"
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.

Class

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