Commit c84445f8 authored by Ben Gamari's avatar Ben Gamari 🐢
Browse files

Rules: Refactor generateTargets

This previously used `fromJust`, which bottomed due to the recent
`isLibrary` change.
parent 139d90d4
......@@ -10,12 +10,12 @@ generateTargets :: Rules ()
generateTargets = action $ do
targets <- fmap concat . forM [Stage0 ..] $ \stage -> do
pkgs <- interpretWithStage stage getPackages
let (libPkgs, programPkgs) = partition isLibrary pkgs
let libPkgs = filter isLibrary pkgs
libTargets <- fmap concat . forM libPkgs $ \pkg -> do
let target = PartialTarget stage pkg
needHaddock <- interpretPartial target buildHaddock
return $ [ pkgHaddockFile pkg | needHaddock && stage == Stage1 ]
let programTargets = map (fromJust . programPath stage) programPkgs
return [ pkgHaddockFile pkg | needHaddock && stage == Stage1 ]
let programTargets = [ prog | Just prog <- programPath stage <$> pkgs ]
return $ libTargets ++ programTargets
need $ reverse targets
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment