Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type Parser = Parsec Void Text
- requireDirective :: Parser RequireDirective
- parseMaybe :: (Ord e, Stream s) => Parsec e s a -> s -> Maybe a
Documentation
parseMaybe :: (Ord e, Stream s) => Parsec e s a -> s -> Maybe a #
runs the parser parseMaybe
p inputp
on input
and returns the
result inside Just
on success and Nothing
on failure. This function
also parses eof
, so if the parser doesn't consume all of its input, it
will fail.
The function is supposed to be useful for lightweight parsing, where error messages (and thus file names) are not important and entire input should be consumed. For example, it can be used for parsing of a single number according to a specification of its format.