projects
/
haskell-directory.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
disambiguate uses of foldr for nhc98 to compile without errors
[haskell-directory.git]
/
Data
/
Tree.hs
diff --git
a/Data/Tree.hs
b/Data/Tree.hs
index
bc103b8
..
a7aab07
100644
(file)
--- a/
Data/Tree.hs
+++ b/
Data/Tree.hs
@@
-28,7
+28,7
@@
module Data.Tree(
import Prelude
#endif
import Prelude
#endif
-import Control.Applicative (Applicative(..))
+import Control.Applicative (Applicative(..), (<$>))
import Control.Monad
import Data.Monoid (Monoid(..))
import Data.Sequence (Seq, empty, singleton, (<|), (|>), fromList,
import Control.Monad
import Data.Monoid (Monoid(..))
import Data.Sequence (Seq, empty, singleton, (<|), (|>), fromList,
@@
-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 []
-- | 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]]
-- | 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
#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
-- | 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
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'])
let (tQ', ts) = splitOnto [] as tQ
return (Node b ts <| tQ')
where splitOnto :: [a'] -> [b'] -> Seq a' -> (Seq a', [a'])