From: Malcolm.Wallace@cs.york.ac.uk Date: Tue, 11 Jul 2006 16:16:14 +0000 (+0000) Subject: disambiguate uses of foldr for nhc98 to compile without errors X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=b9b6e38a1ebb5f05b382609fe0776d91cdd1090b;hp=30464c0cb915c2ae900909568fa8677bba341e45;p=haskell-directory.git disambiguate uses of foldr for nhc98 to compile without errors --- diff --git a/Data/Traversable.hs b/Data/Traversable.hs index 1c7d83b..6754094 100644 --- a/Data/Traversable.hs +++ b/Data/Traversable.hs @@ -27,10 +27,10 @@ module Data.Traversable ( foldMapDefault, ) where -import Prelude hiding (mapM, sequence) -import qualified Prelude (mapM) +import Prelude hiding (mapM, sequence, foldr) +import qualified Prelude (mapM, foldr) import Control.Applicative -import Data.Foldable (Foldable) +import Data.Foldable (Foldable()) import Data.Monoid (Monoid) import Data.Array @@ -90,7 +90,7 @@ instance Traversable Maybe where traverse f (Just x) = Just <$> f x instance Traversable [] where - traverse f = foldr cons_f (pure []) + traverse f = Prelude.foldr cons_f (pure []) where cons_f x ys = (:) <$> f x <*> ys mapM = Prelude.mapM diff --git a/Data/Tree.hs b/Data/Tree.hs index f2a55f5..a7aab07 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -93,7 +93,7 @@ draw (Node x ts0) = x : drawSubTrees ts0 -- | The elements of a tree in pre-order. flatten :: Tree a -> [a] flatten t = squish t [] - where squish (Node x ts) xs = x:foldr squish xs ts + where squish (Node x ts) xs = x:Prelude.foldr squish xs ts -- | Lists of nodes at each level of the tree. levels :: Tree a -> [[a]] @@ -120,7 +120,7 @@ unfoldTreeM f b = do #ifndef __NHC__ unfoldForestM :: Monad m => (b -> m (a, [b])) -> [b] -> m (Forest a) #endif -unfoldForestM f = mapM (unfoldTreeM f) +unfoldForestM f = Prelude.mapM (unfoldTreeM f) -- | Monadic tree builder, in breadth-first order, -- using an algorithm adapted from @@ -146,7 +146,7 @@ unfoldForestQ f aQ = case viewl aQ of EmptyL -> return empty a :< aQ -> do (b, as) <- f a - tQ <- unfoldForestQ f (foldl (|>) aQ as) + tQ <- unfoldForestQ f (Prelude.foldl (|>) aQ as) let (tQ', ts) = splitOnto [] as tQ return (Node b ts <| tQ') where splitOnto :: [a'] -> [b'] -> Seq a' -> (Seq a', [a'])