summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'libraries')
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/PprLib.hs3
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Syntax.hs4
2 files changed, 3 insertions, 4 deletions
diff --git a/libraries/template-haskell/Language/Haskell/TH/PprLib.hs b/libraries/template-haskell/Language/Haskell/TH/PprLib.hs
index 8019e48205..e398094fef 100644
--- a/libraries/template-haskell/Language/Haskell/TH/PprLib.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/PprLib.hs
@@ -154,11 +154,10 @@ instance Functor PprM where
fmap = liftM
instance Applicative PprM where
- pure = return
+ pure x = PprM $ \s -> (x, s)
(<*>) = ap
instance Monad PprM where
- return x = PprM $ \s -> (x, s)
m >>= k = PprM $ \s -> let (x, s') = runPprM m s
in runPprM (k x) s'
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
index 8d56a98dc8..607e6da92c 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
@@ -159,9 +159,8 @@ runQ :: Quasi m => Q a -> m a
runQ (Q m) = m
instance Monad Q where
- return x = Q (return x)
Q m >>= k = Q (m >>= \x -> unQ (k x))
- Q m >> Q n = Q (m >> n)
+ (>>) = (*>)
fail s = report True s >> Q (fail "Q monad failure")
instance Functor Q where
@@ -170,6 +169,7 @@ instance Functor Q where
instance Applicative Q where
pure x = Q (pure x)
Q f <*> Q x = Q (f <*> x)
+ Q m *> Q n = Q (m *> n)
-----------------------------------------------------
--