[project @ 1996-06-11 13:18:54 by partain]
[ghc-hetmet.git] / ghc / compiler / utils / Util.lhs
index c026524..37cb8c0 100644 (file)
@@ -211,6 +211,7 @@ startsWith, endsWith :: String -> String -> Maybe String
 startsWith []     str = Just str
 startsWith (c:cs) (s:ss)
   = if c /= s then Nothing else startsWith cs ss
+startWith  _     []  = Nothing
 
 endsWith cs ss
   = case (startsWith (reverse cs) (reverse ss)) of
@@ -582,11 +583,11 @@ transitiveClosure :: (a -> [a])           -- Successor function
                  -> [a]                -- The transitive closure
 
 transitiveClosure succ eq xs
- = do [] xs
+ = go [] xs
  where
-   do done []                     = done
-   do done (x:xs) | x `is_in` done = do done xs
-                 | otherwise      = do (x:done) (succ x ++ xs)
+   go done []                     = done
+   go done (x:xs) | x `is_in` done = go done xs
+                 | otherwise      = go (x:done) (succ x ++ xs)
 
    x `is_in` []                 = False
    x `is_in` (y:ys) | eq x y    = True