X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FTree.hs;h=5c95f2ab965ca36e187d4a59a66ed9eac026a21b;hb=a4860575fcc59c6fcdf9f7fe74e137264dc05da8;hp=b9d2c54d7226740f5a18db2ea82d5d311600d204;hpb=897ec7c12341f6f2b5f5b34cedf45907f061b2c1;p=ghc-base.git diff --git a/Data/Tree.hs b/Data/Tree.hs index b9d2c54..5c95f2a 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -104,7 +104,7 @@ unfoldForestM f = mapM (unfoldTreeM f) -- | Monadic tree builder, in breadth-first order, -- using an algorithm adapted from --- /Breadth­First Numbering: Lessons from a Small Exercise in Algorithm Design/, +-- /Breadth-First Numbering: Lessons from a Small Exercise in Algorithm Design/, -- by Chris Okasaki, /ICFP'00/. unfoldTreeM_BF :: Monad m => (b -> m (a, [b])) -> b -> m (Tree a) unfoldTreeM_BF f b = liftM (fst . fromJust . deQueue) $ @@ -112,11 +112,11 @@ unfoldTreeM_BF f b = liftM (fst . fromJust . deQueue) $ -- | Monadic forest builder, in breadth-first order, -- using an algorithm adapted from --- /Breadth­First Numbering: Lessons from a Small Exercise in Algorithm Design/, +-- /Breadth-First Numbering: Lessons from a Small Exercise in Algorithm Design/, -- by Chris Okasaki, /ICFP'00/. unfoldForestM_BF :: Monad m => (b -> m (a, [b])) -> [b] -> m (Forest a) unfoldForestM_BF f = liftM (reverseOnto []) . unfoldForestQ f . listToQueue - where reverseOnto :: [a] -> Queue a -> [a] + where reverseOnto :: [a'] -> Queue a' -> [a'] reverseOnto as q = case deQueue q of Nothing -> as Just (a, q') -> reverseOnto (a:as) q' @@ -131,7 +131,7 @@ unfoldForestQ f aQ = case deQueue aQ of tQ <- unfoldForestQ f (foldl addToQueue aQ as) let (ts, tQ') = splitOnto [] as tQ return (addToQueue tQ' (Node b ts)) - where splitOnto :: [a] -> [b] -> Queue a -> ([a], Queue a) + where splitOnto :: [a'] -> [b'] -> Queue a' -> ([a'], Queue a') splitOnto as [] q = (as, q) splitOnto as (_:bs) q = case fromJust (deQueue q) of (a, q') -> splitOnto (a:as) bs q'