projects
/
ghc-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Eliminate orphan rules and instances in the array package
[ghc-base.git]
/
Data
/
Traversable.hs
diff --git
a/Data/Traversable.hs
b/Data/Traversable.hs
index
7ad3991
..
df10679
100644
(file)
--- a/
Data/Traversable.hs
+++ b/
Data/Traversable.hs
@@
-43,6
+43,12
@@
import Control.Applicative
import Data.Foldable (Foldable())
import Data.Monoid (Monoid)
import Data.Foldable (Foldable())
import Data.Monoid (Monoid)
+#if defined(__GLASGOW_HASKELL__)
+import GHC.Arr
+#elif defined(__HUGS__)
+import Hugs.Array
+#endif
+
-- | Functors representing data structures that can be traversed from
-- left to right.
--
-- | Functors representing data structures that can be traversed from
-- left to right.
--
@@
-104,6
+110,11
@@
instance Traversable [] where
mapM = Prelude.mapM
mapM = Prelude.mapM
+#ifndef __NHC__
+instance Ix i => Traversable (Array i) where
+ traverse f arr = listArray (bounds arr) `fmap` traverse f (elems arr)
+#endif
+
-- general functions
-- | 'for' is 'traverse' with its arguments flipped.
-- general functions
-- | 'for' is 'traverse' with its arguments flipped.