summaryrefslogtreecommitdiff
path: root/Main.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2021-02-18 14:18:32 +0100
committerTom Smeding <tom@tomsmeding.com>2021-02-18 14:18:32 +0100
commit70f8330a21c335f36980f4b491d5b4e65a035c1c (patch)
tree17b06e26173e98bf5098c2e918d3ff3dffaf1d9d /Main.hs
parente3ab394665c2c308cab6fffb41b3acc66d0ca989 (diff)
Compatibility with more plan.json files
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Main.hs b/Main.hs
index 5cbf592..c1f5f9b 100644
--- a/Main.hs
+++ b/Main.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE LambdaCase #-}
module Main where
import Control.Monad (forM_, when)
@@ -35,8 +36,9 @@ compatibleTargets pd plan =
parseCabalPlan' :: FoundCabalSpec -> IO CabalPlan
parseCabalPlan' foundSpec =
parseCabalPlan (foundcsRootDir foundSpec </> "dist-newstyle/cache/plan.json")
- >>= maybe (die "Cabal plan.json not found; make sure to run 'cabal build' beforehand")
- return
+ >>= \case NotFound -> die "Cabal plan.json not found; make sure to run 'cabal build' beforehand"
+ ParseError e -> die ("Error when parsing Cabal plan.json: " ++ e)
+ Parsed plan -> return plan
readCachedTargets :: (AnyTarget -> Bool) -> IO (FilePath, [AnyTarget], [(String, [AnyTarget])])
readCachedTargets predicate = do