[commit: packages/Cabal] ghc-head: Apply suggestions from byorgey (4761562)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:28:18 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=4761562f641fd269e9be58aee24486516634ba2c

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

commit 4761562f641fd269e9be58aee24486516634ba2c
Author: Benno Fünfstück <benno.fuenfstueck at gmail.com>
Date:   Thu Jul 11 14:49:18 2013 +0200

    Apply suggestions from byorgey


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

4761562f641fd269e9be58aee24486516634ba2c
 Cabal/Distribution/PackageDescription/Parse.hs |    3 ++-
 Cabal/Distribution/ParseUtils.hs               |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Cabal/Distribution/PackageDescription/Parse.hs b/Cabal/Distribution/PackageDescription/Parse.hs
index 6a786c3..2d1c153 100644
--- a/Cabal/Distribution/PackageDescription/Parse.hs
+++ b/Cabal/Distribution/PackageDescription/Parse.hs
@@ -74,6 +74,7 @@ import Data.Monoid ( Monoid(..) )
 import Data.List  (nub, unfoldr, partition, (\\))
 import Control.Monad (liftM, foldM, when, unless, ap)
 import Control.Applicative (Applicative(..))
+import Control.Arrow (first)
 import System.Directory (doesFileExist)
 import qualified Data.ByteString.Lazy.Char8 as BS.Char8
 
@@ -604,7 +605,7 @@ buildInfoNames = map fieldName binfoFieldDescrs
 newtype StT s m a = StT { runStT :: s -> m (a,s) }
 
 instance Functor f => Functor (StT s f) where
-    fmap g (StT f) = StT $ \s -> fmap (\(a,s') -> (g a,s')) $ f s
+    fmap g (StT f) = StT $ fmap (first g)  . f
 
 instance (Monad m, Functor m) => Applicative (StT s m) where
     pure = return
diff --git a/Cabal/Distribution/ParseUtils.hs b/Cabal/Distribution/ParseUtils.hs
index 07d91c7..298660c 100644
--- a/Cabal/Distribution/ParseUtils.hs
+++ b/Cabal/Distribution/ParseUtils.hs
@@ -121,7 +121,7 @@ instance Functor ParseResult where
         fmap f (ParseOk ws x) = ParseOk ws $ f x
         
 instance Applicative ParseResult where
-        pure = ParseOk []
+        pure = return
         (<*>) = ap
         
 





More information about the ghc-commits mailing list