Maintainer | CS 131, Programming Languages (Melissa O'Neill, Chris Stone, Ben Wiedermann) |
---|---|
Safe Haskell | Safe |
NOTE: You do not need to understand the code in this file. It uses some features of Haskell that we have not yet learned.
Synopsis
- data Parser a
- pfail :: Parser a
- get :: Parser Char
- parse :: Parser a -> String -> a
- parseFile :: Parser a -> String -> IO a
- parseNamed :: Parser a -> String -> String -> a
- (<||>) :: Parser a -> Parser a -> Parser a
- succeeding :: a -> Parser a -> Parser a
- eof :: Parser ()
- (<|>) :: Alternative f => f a -> f a -> f a
- some :: Alternative f => f a -> f [a]
- many :: Alternative f => f a -> f [a]
- class Applicative f => Alternative (f :: Type -> Type)
- class (Alternative m, Monad m) => MonadPlus (m :: Type -> Type)
- empty :: Alternative f => f a
- join :: Monad m => m (m a) -> m a
- mfilter :: MonadPlus m => (a -> Bool) -> m a -> m a
Documentation
Has the capacity to invoke a parsing function on an input string, and look for
a result of type a
.
parse :: Parser a -> String -> a #
Given a 'Parser a' and an input string, return a value of type a
if the parser
matches the entire input string.
parseFile :: Parser a -> String -> IO a #
Given a 'Parser a' and the path to a file, return a value of type 'IO a' if the parser matches the entire contents of the file.
parseNamed :: Parser a -> String -> String -> a #
(<||>) :: Parser a -> Parser a -> Parser a infixl 3 #
Alternatives. Succeeds if either parser succeeds. If the parse fails, the error information comes from the second parser.
succeeding :: a -> Parser a -> Parser a #
(<|>) :: Alternative f => f a -> f a -> f a #
some :: Alternative f => f a -> f [a] #
many :: Alternative f => f a -> f [a] #
class Applicative f => Alternative (f :: Type -> Type) #
Instances
Alternative [] | |
Alternative Maybe | |
Alternative IO | |
Alternative ZipList | |
Alternative P | |
Alternative ReadP | |
Alternative Parser # | |
MonadPlus m => Alternative (WrappedMonad m) | |
ArrowPlus a => Alternative (ArrowMonad a) | |
(ArrowZero a, ArrowPlus a) => Alternative (WrappedArrow a b) | |
class (Alternative m, Monad m) => MonadPlus (m :: Type -> Type) #
Instances
MonadPlus [] | |
MonadPlus Maybe | |
MonadPlus IO | |
MonadPlus P | |
Defined in Text.ParserCombinators.ReadP | |
MonadPlus ReadP | |
Defined in Text.ParserCombinators.ReadP | |
MonadPlus Parser # | |
(ArrowApply a, ArrowPlus a) => MonadPlus (ArrowMonad a) | |
Defined in Control.Arrow |
empty :: Alternative f => f a #