summaryrefslogtreecommitdiff
path: root/libraries/base/Text
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/base/Text')
-rw-r--r--libraries/base/Text/ParserCombinators/ReadP.hs7
-rw-r--r--libraries/base/Text/ParserCombinators/ReadPrec.hs3
2 files changed, 3 insertions, 7 deletions
diff --git a/libraries/base/Text/ParserCombinators/ReadP.hs b/libraries/base/Text/ParserCombinators/ReadP.hs
index 034411d6bf..bae2abc90e 100644
--- a/libraries/base/Text/ParserCombinators/ReadP.hs
+++ b/libraries/base/Text/ParserCombinators/ReadP.hs
@@ -103,7 +103,7 @@ data P a
-- Monad, MonadPlus
instance Applicative P where
- pure = return
+ pure x = Result x Fail
(<*>) = ap
instance MonadPlus P where
@@ -111,8 +111,6 @@ instance MonadPlus P where
mplus = (<|>)
instance Monad P where
- return x = Result x Fail
-
(Get f) >>= k = Get (\c -> f c >>= k)
(Look f) >>= k = Look (\s -> f s >>= k)
Fail >>= _ = Fail
@@ -161,11 +159,10 @@ instance Functor ReadP where
fmap h (R f) = R (\k -> f (k . h))
instance Applicative ReadP where
- pure = return
+ pure x = R (\k -> k x)
(<*>) = ap
instance Monad ReadP where
- return x = R (\k -> k x)
fail _ = R (\_ -> Fail)
R m >>= f = R (\k -> m (\a -> let R m' = f a in m' k))
diff --git a/libraries/base/Text/ParserCombinators/ReadPrec.hs b/libraries/base/Text/ParserCombinators/ReadPrec.hs
index 027648d9e8..02268364ca 100644
--- a/libraries/base/Text/ParserCombinators/ReadPrec.hs
+++ b/libraries/base/Text/ParserCombinators/ReadPrec.hs
@@ -75,11 +75,10 @@ instance Functor ReadPrec where
fmap h (P f) = P (\n -> fmap h (f n))
instance Applicative ReadPrec where
- pure = return
+ pure x = P (\_ -> pure x)
(<*>) = ap
instance Monad ReadPrec where
- return x = P (\_ -> return x)
fail s = P (\_ -> fail s)
P f >>= k = P (\n -> do a <- f n; let P f' = k a in f' n)