[project @ 2004-02-04 17:00:00 by malcolm]
authormalcolm <unknown>
Wed, 4 Feb 2004 17:00:00 +0000 (17:00 +0000)
committermalcolm <unknown>
Wed, 4 Feb 2004 17:00:00 +0000 (17:00 +0000)
Excluding 'unfoldTreeM' and 'unfoldForestM' is overkill for nhc98.
A simpler workaround for the type inference bug is just to omit one
type signature from the mutually recursive pair.

Data/Tree.hs

index d04fe3d..b9d2c54 100644 (file)
@@ -20,9 +20,7 @@ module Data.Tree(
        flatten, levels,
        -- * Building trees
        unfoldTree, unfoldForest,
-#ifndef __NHC__
        unfoldTreeM, unfoldForestM,
-#endif
        unfoldTreeM_BF, unfoldForestM_BF,
     ) where
 
@@ -91,7 +89,6 @@ unfoldTree f b = let (a, bs) = f b in Node a (unfoldForest f bs)
 unfoldForest :: (b -> (a, [b])) -> [b] -> Forest a
 unfoldForest f = map (unfoldTree f)
 
-#ifndef __NHC__
 -- | Monadic tree builder, in depth-first order
 unfoldTreeM :: Monad m => (b -> m (a, [b])) -> b -> m (Tree a)
 unfoldTreeM f b = do
@@ -100,9 +97,10 @@ unfoldTreeM f b = do
        return (Node a ts)
 
 -- | Monadic forest builder, in depth-first order
+#ifndef __NHC__
 unfoldForestM :: Monad m => (b -> m (a, [b])) -> [b] -> m (Forest a)
-unfoldForestM f = mapM (unfoldTreeM f)
 #endif
+unfoldForestM f = mapM (unfoldTreeM f)
 
 -- | Monadic tree builder, in breadth-first order,
 -- using an algorithm adapted from