{-# LANGUAGE EmptyDataDecls, FlexibleInstances #-}
module Text.ParserCombinators.Incremental.Symmetric (
module Text.ParserCombinators.Incremental,
Parser, Symmetric, allOf
)
where
import Control.Applicative (Alternative (empty, (<|>)), many, some)
import Control.Monad (MonadPlus (mzero, mplus))
import Data.Monoid (Monoid)
import Text.ParserCombinators.Incremental hiding (Parser)
import qualified Text.ParserCombinators.Incremental as Incremental (Parser)
data Symmetric
type Parser = Incremental.Parser Symmetric
instance Monoid s => Alternative (Incremental.Parser Symmetric s) where
empty :: Parser Symmetric s a
empty = Parser Symmetric s a
forall t s r. Parser t s r
failure
Parser Symmetric s a
p1 <|> :: Parser Symmetric s a
-> Parser Symmetric s a -> Parser Symmetric s a
<|> Parser Symmetric s a
p2 = Parser Symmetric s a
p1 Parser Symmetric s a
-> Parser Symmetric s a -> Parser Symmetric s a
forall t s r. Parser t s r -> Parser t s r -> Parser t s r
<||> Parser Symmetric s a
p2
many :: Parser Symmetric s a -> Parser Symmetric s [a]
many = Parser Symmetric s a -> Parser Symmetric s [a]
forall s t r.
(Monoid s, Alternative (Parser t s)) =>
Parser t s r -> Parser t s [r]
defaultMany
some :: Parser Symmetric s a -> Parser Symmetric s [a]
some = Parser Symmetric s a -> Parser Symmetric s [a]
forall s t r.
(Monoid s, Alternative (Parser t s)) =>
Parser t s r -> Parser t s [r]
defaultSome
instance Monoid s => MonadPlus (Incremental.Parser Symmetric s) where
mzero :: Parser Symmetric s a
mzero = Parser Symmetric s a
forall t s r. Parser t s r
failure
mplus :: Parser Symmetric s a
-> Parser Symmetric s a -> Parser Symmetric s a
mplus = Parser Symmetric s a
-> Parser Symmetric s a -> Parser Symmetric s a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
(<|>)
allOf :: Parser s r -> Incremental.Parser a s r
allOf :: Parser s r -> Parser a s r
allOf Parser s r
p = (forall a. Parser Symmetric s a -> Parser a s a)
-> Parser s r -> Parser a s r
forall t s b r.
(forall a. Parser t s a -> Parser b s a)
-> Parser t s r -> Parser b s r
mapType forall a. Parser Symmetric s a -> Parser a s a
forall s r a. Parser s r -> Parser a s r
allOf Parser s r
p