[commit: packages/containers] ghc-head: Avoid dependency on Applicative (ST s) instance ... (4f7bc51)
git at git.haskell.org
git at git.haskell.org
Thu Jan 16 07:50:56 UTC 2014
Repository : ssh://git@git.haskell.org/containers
On branch : ghc-head
Link : http://git.haskell.org/packages/containers.git/commitdiff/4f7bc51fe6eb40f6b17bb2ee2906e0b03fdbab0d
>---------------------------------------------------------------
commit 4f7bc51fe6eb40f6b17bb2ee2906e0b03fdbab0d
Author: Milan Straka <fox at ucw.cz>
Date: Mon Oct 7 18:39:45 2013 +0200
Avoid dependency on Applicative (ST s) instance ...
... present only in GHC 7.2+.
>---------------------------------------------------------------
4f7bc51fe6eb40f6b17bb2ee2906e0b03fdbab0d
Data/Graph.hs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Data/Graph.hs b/Data/Graph.hs
index 3ddc4be..c5cdf4b 100644
--- a/Data/Graph.hs
+++ b/Data/Graph.hs
@@ -302,7 +302,10 @@ instance Functor (SetM s) where
instance Applicative (SetM s) where
pure x = SetM $ const (return x)
{-# INLINE pure #-}
- SetM f <*> SetM v = SetM $ \s -> f s <*> v s
+ SetM f <*> SetM v = SetM $ \s -> f s >>= (`fmap` v s)
+ -- We could also use the following definition
+ -- SetM f <*> SetM v = SetM $ \s -> f s <*> v s
+ -- but Applicative (ST s) instance is present only in GHC 7.2+
{-# INLINE (<*>) #-}
run :: Bounds -> (forall s. SetM s a) -> a
More information about the ghc-commits
mailing list