Repository : ssh://darcs.haskell.org//srv/darcs/haddock On branch : ghc-7.6
http://hackage.haskell.org/trac/ghc/changeset/bfaff48e91dd9f2f3d94739851ab18e7d872c7ff >--------------------------------------------------------------- commit bfaff48e91dd9f2f3d94739851ab18e7d872c7ff Author: Simon Hengel <s...@typeful.net> Date: Sun Oct 7 18:06:08 2012 +0200 runtests.hs: Use listToMaybe/fromMaybe instead of safeHead/maybe >--------------------------------------------------------------- tests/html-tests/runtests.hs | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/html-tests/runtests.hs b/tests/html-tests/runtests.hs index 2f218d1..28bf2f7 100644 --- a/tests/html-tests/runtests.hs +++ b/tests/html-tests/runtests.hs @@ -68,12 +68,12 @@ test = do (_, conf) <- configure normal (Just ghcPath) Nothing defaultProgramConfiguration pkgIndex <- getInstalledPackages normal [GlobalPackageDB] conf let mkDep pkgName = - maybe (error "Couldn't find test dependencies") id $ do + fromMaybe (error "Couldn't find test dependencies") $ do let pkgs = lookupPackageName pkgIndex (PackageName pkgName) - (_, pkgs') <- safeHead pkgs - pkg <- safeHead pkgs' - ifacePath <- safeHead (haddockInterfaces pkg) - htmlPath <- safeHead (haddockHTMLs pkg) + (_, pkgs') <- listToMaybe pkgs + pkg <- listToMaybe pkgs' + ifacePath <- listToMaybe (haddockInterfaces pkg) + htmlPath <- listToMaybe (haddockHTMLs pkg) return ("-i " ++ htmlPath ++ "," ++ ifacePath) let base = mkDep "base" @@ -90,10 +90,6 @@ test = do wait handle "*** Haddock run failed! Exiting." check mods (if not (null args) && args !! 0 == "all" then False else True) where - - safeHead :: [a] -> Maybe a - safeHead xs = case xs of x : _ -> Just x; [] -> Nothing - wait :: ProcessHandle -> String -> IO () wait h msg = do r <- waitForProcess h _______________________________________________ Cvs-ghc mailing list Cvs-ghc@haskell.org http://www.haskell.org/mailman/listinfo/cvs-ghc