Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report all missing packages together #223

hdgarrood opened this issue May 30, 2019 · 1 comment


None yet
2 participants
Copy link

commented May 30, 2019

If there are a number of packages which are listed as dependencies in my spago.dhall but which do not exist in my package set, spago reports these one by one. For example:

$ spago build
spago: Package `fixed-precision` does not exist in package set
# Add `fixed-precision` ...
$ spago build
spago: Package `reflection` does not exist in package set
# Add `reflection` ...
$ spago build

I think it would be better to report all missing packages together, if possible. Of course it won't always be possible to do so: suppose package A depends on package B, and package B depends on C, and I add A as an addition without adding B or C; in this case we might not know that C is missing until we add B.

For a minimal reproduction example, run spago init in an empty directory, and modify the spago.dhall file as follows:

Welcome to a Spago project!
You can edit this file as you like.
{ name =
, dependencies =
    [ "effect", "console", "psci-support", "blah", "what" ]
, packages =

and then run spago build. The error you receive is:

spago: Package `blah` does not exist in package set

However, it would be nicer to get something like

spago: The following packages do not exist in your package set:
  - blah
  - what

This comment has been minimized.

Copy link

commented May 30, 2019

Nice report, thanks 🙂

Agreed that this is not good behaviour and reporting all errors at the same time is much better. The fix should be quite fine: on line 101 instead of calling die we should accumulate the missing packages in the fold and then die at the end if any:

-- | Return the transitive dependencies of a list of packages
-- Code basically from here:
getTransitiveDeps :: Spago m => PackageSet -> [PackageName] -> m [(PackageName, Package)]
getTransitiveDeps packageSet deps =
Map.toList . fold <$> traverse (go Set.empty) deps
go seen dep
| dep `Set.member` seen =
die $ "Cycle in package dependencies at package " <> packageName dep
| otherwise =
case Map.lookup dep packageSet of
Nothing ->
die $ pkgNotFoundMsg dep
Just info@Package{..} -> do
m <- fold <$> traverse (go (Set.insert dep seen)) dependencies
pure (Map.insert dep info m)

@f-f f-f added this to the 1.0 milestone Jun 12, 2019

@eahlberg eahlberg referenced this issue Jun 14, 2019


Report all missing packages #264

1 of 3 tasks complete

@f-f f-f closed this in #264 Jun 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.