{-# LANGUAGE EmptyDataDecls, FlexibleInstances #-}
module Text.ParserCombinators.Incremental.LeftBiasedLocal (
module Text.ParserCombinators.Incremental,
Parser, LeftBiasedLocal, leftmost
)
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 LeftBiasedLocal
type Parser = Incremental.Parser LeftBiasedLocal
instance Monoid s => Alternative (Incremental.Parser LeftBiasedLocal s) where
empty :: Parser LeftBiasedLocal s a
empty = Parser LeftBiasedLocal s a
forall t s r. Parser t s r
failure
Parser LeftBiasedLocal s a
p1 <|> :: Parser LeftBiasedLocal s a
-> Parser LeftBiasedLocal s a -> Parser LeftBiasedLocal s a
<|> Parser LeftBiasedLocal s a
p2 = Parser LeftBiasedLocal s a
p1 Parser LeftBiasedLocal s a
-> Parser LeftBiasedLocal s a -> Parser LeftBiasedLocal s a
forall s t r.
Monoid s =>
Parser t s r -> Parser t s r -> Parser t s r
<<|> Parser LeftBiasedLocal s a
p2
many :: Parser LeftBiasedLocal s a -> Parser LeftBiasedLocal s [a]
many = Parser LeftBiasedLocal s a -> Parser LeftBiasedLocal s [a]
forall s t r.
(Monoid s, Alternative (Parser t s)) =>
Parser t s r -> Parser t s [r]
defaultMany
some :: Parser LeftBiasedLocal s a -> Parser LeftBiasedLocal s [a]
some = Parser LeftBiasedLocal s a -> Parser LeftBiasedLocal 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 LeftBiasedLocal s) where
mzero :: Parser LeftBiasedLocal s a
mzero = Parser LeftBiasedLocal s a
forall t s r. Parser t s r
failure
mplus :: Parser LeftBiasedLocal s a
-> Parser LeftBiasedLocal s a -> Parser LeftBiasedLocal s a
mplus = Parser LeftBiasedLocal s a
-> Parser LeftBiasedLocal s a -> Parser LeftBiasedLocal s a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
(<|>)
leftmost :: Parser s r -> Incremental.Parser a s r
leftmost :: Parser s r -> Parser a s r
leftmost Parser s r
p = (forall a. Parser LeftBiasedLocal 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 LeftBiasedLocal s a -> Parser a s a
forall s r a. Parser s r -> Parser a s r
leftmost Parser s r
p