haskell / statistics

A fast, high quality library for computing with statistics in Haskell.
http://hackage.haskell.org/package/statistics
BSD 2-Clause "Simplified" License
300 stars 68 forks source link

stack.yaml is outdated #189

Closed lorinder closed 1 year ago

lorinder commented 1 year ago

Problem

When trying to compile statistics with stack (i.e., running stack build), it fails with the following error message:

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for statistics-0.16.1.0:
    math-functions-0.3.0.2 from stack configuration does not match >=0.3.4.1  (latest matching version is 0.3.4.2)
    mwc-random-0.13.6.0 from stack configuration does not match >=0.15.0.0  (latest matching version is 0.15.0.2)
    random-1.1 from stack configuration does not match >=1.2  (latest matching version is 1.2.1.1)
needed since statistics is a build target.

Some different approaches to resolving this:

  * Set 'allow-newer: true' in [redacted]\config.yaml to ignore all version constraints and build anyway.

  * Recommended action: try adding the following to your extra-deps in [redacted]\statistics\stack.yaml:

- math-functions-0.3.4.2@sha256:5d942f0d6478c2a6b22049c033943538f8dd357c66ff874d328082136433cafb,4791
- mwc-random-0.15.0.2@sha256:109e0fb72ce64bda468fc44d9cb5abbf455d6337140b57eb851a8183baba0597,3372
- random-1.2.1.1@sha256:dea1f11e5569332dc6c8efaad1cb301016a5587b6754943a49f9de08ae0e56d9,6541

Plan construction failed.

The cause seems to be that the stack.yaml file declares dependencies that are incompatible with what statistics.cabal declares, i.e., stack.yaml declares a dependency on math-functions-0.3.0.2, whereas according to statistics.cabal, version >= 0.3.4.1 of that package is needed.

Workaround

Delete stack.yaml, run stack init to create that file, then run stack build. This worked for me. The generated stack.yaml file (with comments removed) is as follows:

resolver:
  url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/1.yaml

packages:
- dense-linear-algebra
- .

Proposed solution

The stack.yaml file could be updated. However, if core developers of the package are not using stack, it seems likely that it would become outdated again very soon. Therefore it is probably better to simply remove the stack.yaml file, as it is trivial to generate with stack init if one wants to use stack.

Shimuuar commented 1 year ago

Thank you for report! I just deleted stack.yaml since I don't use it. It will go stale again otherwise