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

Closed
hdgarrood opened this issue May 30, 2019 · 1 comment · Fixed by #264
Closed

Report all missing packages together #223

hdgarrood opened this issue May 30, 2019 · 1 comment · Fixed by #264

Comments

@hdgarrood
Copy link
Contributor

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 =
    "my-project"
, dependencies =
    [ "effect", "console", "psci-support", "blah", "what" ]
, packages =
    ./packages.dhall
}

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
@f-f
Copy link
Member

f-f 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:
https://github.com/spacchetti/spago/blob/05815ce7a7f2cbf0767a421e2ebf6b028385e69d/app/Spago/Packages.hs#L88-L104

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants