diff options
| author | Simon Hengel <sol@typeful.net> | 2012-10-07 18:06:08 +0200 | 
|---|---|---|
| committer | Simon Hengel <sol@typeful.net> | 2012-10-07 19:06:34 +0200 | 
| commit | bfaff48e91dd9f2f3d94739851ab18e7d872c7ff (patch) | |
| tree | 47434d6dbdc2d7ea534f9b15cc2db2803c7b6df1 | |
| parent | 13e5da9d435168a81060e6cc6a262a4fe5315934 (diff) | |
runtests.hs: Use listToMaybe/fromMaybe instead of safeHead/maybe
| -rw-r--r-- | 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 2f218d17..28bf2f7e 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  | 
