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":: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27
Moduleparsers-0.12.12Haskell2010
Parsers for character streams
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"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"oneOfSet cs succeeds if the current character is in the supplied
set of characters cs. Returns the parsed character. See also
satisfy.
vowel = oneOf "aeiou"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"Skips zero or more white space characters. See also skipMany.
Parses a white space character (any character which satisfies isSpace) Returns the parsed character.
Parses a newline character ('\n'). Returns a newline character.
Parses a tab character ('\t'). Returns a tab character.
Parses an upper case letter. Returns the parsed character.
Parses a lower case character. Returns the parsed character.
Parses a letter or digit. Returns the parsed character.
Parses a letter (an upper case or lower case character). Returns the parsed character.
Parses a digit. Returns the parsed character.
Parses a hexadecimal digit (a digit or a letter between 'a' and 'f' or 'A' and 'F'). Returns the parsed character.
Parses an octal digit (a character between '0' and '7'). Returns the parsed character.
Additional functionality needed to parse character streams.
satisfy :: (Char -> Bool) -> m CharParse a single character of the input, with UTF-8 decoding
char :: Char -> m CharnotChar :: Char -> m CharnotChar c parses any single character other than c. Returns the parsed
character.
anyChar :: m CharThis parser succeeds for any character. Returns the parsed character.
string :: String -> m Stringstring s parses a sequence of characters given by s. Returns
the parsed string (i.e. s).
divOrMod = string "div"
<|> string "mod"text :: Text -> m Texttext 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"CharParsing ReadPDefined in parsers-0.12.12 · Text.Parser.CharChunk t => CharParsing (Parser t)Defined in parsers-0.12.12 · Text.Parser.CharCharParsing m => CharParsing (Unhighlighted m)Defined in parsers-0.12.12 · Text.Parser.TokenCharParsing m => CharParsing (Unlined m)Defined in parsers-0.12.12 · Text.Parser.TokenCharParsing m => CharParsing (Unspaced m)Defined in parsers-0.12.12 · Text.Parser.Token(CharParsing m, MonadPlus m) => CharParsing (IdentityT m)Defined in parsers-0.12.12 · Text.Parser.Char(CharParsing m, MonadPlus m) => CharParsing (ReaderT e m)Defined in parsers-0.12.12 · Text.Parser.Char(CharParsing m, MonadPlus m) => CharParsing (StateT s m)Defined in parsers-0.12.12 · Text.Parser.Char(CharParsing m, MonadPlus m) => CharParsing (StateT s m)Defined in parsers-0.12.12 · Text.Parser.Char(CharParsing m, MonadPlus m, Monoid w) => CharParsing (WriterT w m)Defined in parsers-0.12.12 · Text.Parser.Char(CharParsing m, MonadPlus m, Monoid w) => CharParsing (WriterT w m)Defined in parsers-0.12.12 · Text.Parser.CharStream s m Char => CharParsing (ParsecT s u m)Defined in parsers-0.12.12 · Text.Parser.Char(CharParsing m, MonadPlus m, Monoid w) => CharParsing (RWST r w s m)Defined in parsers-0.12.12 · Text.Parser.Char(CharParsing m, MonadPlus m, Monoid w) => CharParsing (RWST r w s m)Defined in parsers-0.12.12 · Text.Parser.Char