[commit: packages/template-haskell] master: Fix AMP warnings (ef450ad)
git at git.haskell.org
git at git.haskell.org
Sun Sep 8 15:51:13 CEST 2013
Repository : ssh://git@git.haskell.org/template-haskell
On branch : master
Link : http://git.haskell.org/?p=packages/template-haskell.git;a=commit;h=ef450adbe7db3dc6de6a552c36701d1a2354b36e
>---------------------------------------------------------------
commit ef450adbe7db3dc6de6a552c36701d1a2354b36e
Author: David Luposchainsky <dluposchainsky at gmail.com>
Date: Fri Sep 6 19:51:11 2013 +0200
Fix AMP warnings
Signed-off-by: Austin Seipp <aseipp at pobox.com>
>---------------------------------------------------------------
ef450adbe7db3dc6de6a552c36701d1a2354b36e
Language/Haskell/TH/PprLib.hs | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/Language/Haskell/TH/PprLib.hs b/Language/Haskell/TH/PprLib.hs
index 42856bb..6f36fd7 100644
--- a/Language/Haskell/TH/PprLib.hs
+++ b/Language/Haskell/TH/PprLib.hs
@@ -38,7 +38,8 @@ module Language.Haskell.TH.PprLib (
import Language.Haskell.TH.Syntax
(Name(..), showName', NameFlavour(..), NameIs(..))
import qualified Text.PrettyPrint as HPJ
-import Control.Monad (liftM, liftM2)
+import Control.Applicative (Applicative(..))
+import Control.Monad (liftM, liftM2, ap)
import Data.Map ( Map )
import qualified Data.Map as Map ( lookup, insert, empty )
import GHC.Base (Int(..))
@@ -147,6 +148,13 @@ data NameFlavour
to_HPJ_Doc :: Doc -> HPJ.Doc
to_HPJ_Doc d = fst $ runPprM d (Map.empty, 0)
+instance Functor PprM where
+ fmap = liftM
+
+instance Applicative PprM where
+ pure = return
+ (<*>) = ap
+
instance Monad PprM where
return x = PprM $ \s -> (x, s)
m >>= k = PprM $ \s -> let (x, s') = runPprM m s
More information about the ghc-commits
mailing list