[commit: packages/Cabal] ghc-head: Fix AMP warnings (de31c19)

git at git.haskell.org git at git.haskell.org
Fri Sep 13 17:55:27 CEST 2013


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=de31c19c649aa0778953cc4436b68b748c26c905

>---------------------------------------------------------------

commit de31c19c649aa0778953cc4436b68b748c26c905
Author: David Luposchainsky <dluposchainsky at gmail.com>
Date:   Fri Sep 6 19:49:20 2013 +0200

    Fix AMP warnings


>---------------------------------------------------------------

de31c19c649aa0778953cc4436b68b748c26c905
 Cabal/Distribution/Compat/ReadP.hs       |   10 +++++++---
 Cabal/Distribution/Simple/BuildTarget.hs |    6 +++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Cabal/Distribution/Compat/ReadP.hs b/Cabal/Distribution/Compat/ReadP.hs
index 44b970e..c998e00 100644
--- a/Cabal/Distribution/Compat/ReadP.hs
+++ b/Cabal/Distribution/Compat/ReadP.hs
@@ -69,9 +69,9 @@ module Distribution.Compat.ReadP
   )
  where
 
-import Control.Monad( MonadPlus(..), liftM2, ap )
+import Control.Monad( MonadPlus(..), liftM, liftM2, ap )
 import Data.Char (isSpace)
-import Control.Applicative (Applicative(..))
+import Control.Applicative (Applicative(..), Alternative(empty, (<|>)))
 
 infixr 5 +++, <++
 
@@ -89,7 +89,7 @@ data P s a
 -- Monad, MonadPlus
 
 instance Functor (P s) where
-  fmap f x = x >>= return . f
+  fmap = liftM
 
 instance Applicative (P s) where
   pure = return
@@ -106,6 +106,10 @@ instance Monad (P s) where
 
   fail _ = Fail
 
+instance Alternative (P s) where
+      empty = mzero
+      (<|>) = mplus
+
 instance MonadPlus (P s) where
   mzero = Fail
 
diff --git a/Cabal/Distribution/Simple/BuildTarget.hs b/Cabal/Distribution/Simple/BuildTarget.hs
index f2ef908..b584288 100644
--- a/Cabal/Distribution/Simple/BuildTarget.hs
+++ b/Cabal/Distribution/Simple/BuildTarget.hs
@@ -55,7 +55,7 @@ import Data.Either
          ( partitionEithers )
 import qualified Data.Map as Map
 import Control.Monad
-import Control.Applicative (Applicative(..))
+import Control.Applicative (Applicative(..), Alternative(..))
 import qualified Distribution.Compat.ReadP as Parse
 import Distribution.Compat.ReadP
          ( (+++), (<++) )
@@ -745,6 +745,10 @@ data MatchError = MatchErrorExpected String String
   deriving (Show, Eq)
 
 
+instance Alternative Match where
+      empty = mzero
+      (<|>) = mplus
+
 instance MonadPlus Match where
   mzero = matchZero
   mplus = matchPlus




More information about the ghc-commits mailing list