Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Text/Earley/Generator/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ instance Alternative (Results t s) where
Results sxs <|> Results sys = Results $ (<|>) <$> sxs <*> sys

instance Monad (Results t s) where
return = pure
Results stxs >>= f = Results $ do
xs <- stxs
concat <$> mapM (\(x, ts) -> fmap (\(y, ts') -> (y, ts' ++ ts)) <$> unResults (f x)) xs
Expand All @@ -93,7 +92,6 @@ instance Semigroup (Results s t a) where

instance Monoid (Results s t a) where
mempty = empty
mappend = (<>)

-------------------------------------------------------------------------------
-- * States and continuations
Expand Down
4 changes: 1 addition & 3 deletions Text/Earley/Grammar.hs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ instance Semigroup a => Semigroup (Prod r e t a) where
-- | Lifted instance: @mempty = 'pure' 'mempty'@
instance Monoid a => Monoid (Prod r e t a) where
mempty = pure mempty
mappend = (<>)

instance Functor (Prod r e t) where
{-# INLINE fmap #-}
Expand Down Expand Up @@ -161,11 +160,10 @@ instance Functor (Grammar r) where
fmap f (Return x) = Return $ f x

instance Applicative (Grammar r) where
pure = return
pure = Return
(<*>) = ap

instance Monad (Grammar r) where
return = Return
RuleBind ps f >>= k = RuleBind ps (f >=> k)
FixBind f g >>= k = FixBind f (g >=> k)
Return x >>= k = k x
Expand Down
2 changes: 0 additions & 2 deletions Text/Earley/Parser/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ instance Alternative (Results s) where
Results sxs <|> Results sys = Results $ (<|>) <$> sxs <*> sys

instance Monad (Results s) where
return = pure
Results stxs >>= f = Results $ do
xs <- stxs
concat <$> mapM (unResults . f) xs
Expand All @@ -95,7 +94,6 @@ instance Semigroup (Results s a) where

instance Monoid (Results s a) where
mempty = empty
mappend = (<>)

-------------------------------------------------------------------------------
-- * States and continuations
Expand Down