Commit 8657341d authored by Ben Gamari's avatar Ben Gamari 🐢
Browse files

Eliminate some uses of fromJust

parent d3d00b0c
......@@ -98,11 +98,14 @@ isOptional = \case
Objdump -> True
_ -> False
-- TODO: Get rid of fromJust.
-- | Determine the location of a 'Builder'.
builderPath :: Builder -> Action FilePath
builderPath builder = case builderProvenance builder of
Just context -> return . fromJust $ programPath context
Just context
| Just path <- programPath context -> return path
| otherwise ->
error $ "Cannot determine builderPath for " ++ show builder
++ " in context " ++ show context
Nothing -> case builder of
Alex -> fromKey "alex"
Ar -> fromKey "ar"
......
......@@ -49,7 +49,13 @@ topLevelTargets = do
docs <- interpretInContext context $ buildHaddock flavour
need $ libs ++ [ pkgHaddockFile context | docs && stage == Stage1 ]
else do -- otherwise build a program
need [ fromJust $ programPath context ] -- TODO: drop fromJust
need [ getProgramPath context ]
where
getProgramPath context =
case programPath context of
Nothing -> error $ "topLevelTargets: Can't determine program path for context "
++ show context
Just path -> path
packageRules :: Rules ()
packageRules = do
......
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