diff options
author | Tom Smeding <tom@tomsmeding.com> | 2021-02-18 14:18:32 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2021-02-18 14:18:32 +0100 |
commit | 70f8330a21c335f36980f4b491d5b4e65a035c1c (patch) | |
tree | 17b06e26173e98bf5098c2e918d3ff3dffaf1d9d /Main.hs | |
parent | e3ab394665c2c308cab6fffb41b3acc66d0ca989 (diff) |
Compatibility with more plan.json files
Diffstat (limited to 'Main.hs')
-rw-r--r-- | Main.hs | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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 |