commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
4k stars 843 forks source link

Use hpack executable from PATH if it is newer than what stack ships with? #3809

Open sol opened 6 years ago

sol commented 6 years ago

The latest version of hpack has a --numeric-version option. With this it would be possible for stack to check if there is a newer version of hpack installed on a users system and if so use that instead of the bundled hpack.

This is just a suggestion, not a request to add.

(cc @scott-fleischman who did related stuff before)

mgsloan commented 6 years ago

Hmm, sure, this makes sense to me!

amir commented 6 years ago

Does this also require introducing a new config to allow the override to happen (e.g., configAllowHpacCommandNewer)?

quasicomputational commented 6 years ago

+1 from me, with a switch to disable if you really want the wired-in hpack.

vlatkoB commented 6 years ago

IMHO, hpack should not be included in stack at all, but should always use external/system installed hpack.

hpack is a separate project, completely unrelated to stack's functionality, has its own pace of release (bug fixes and new features), which will force stack to release more often just to keep up with hpack, or fall behind, increasing the maintenance burden. (For example, latest stack-1.6.5 packs hpack-0.20.0, and hpack is already on version 0.28.0.)

I mean, if you want to use the hpack functionality, you should have hpack installed (likewise, if you want documentation, you have to install haddock, otherwise stack reports about missing bin).

philderbeast commented 6 years ago

Another option aside from being bundled with stack or being picked up from the environment is to use project relative tools, to have stack install a version of a tool relative to the project. These tool versions could then be specified and locked down in the project. I do this at the moment when installing dhall;

With a separate stack-dhall.yaml, I can use a different resolver for tooling than I do for the project;

resolver: lts-12.5
flags: {}
packages: []
extra-deps:
- dhall-1.16.1
- hpack-dhall-0.3.0
- dhall-nix-1.1.5
- hnix-0.5.2
- serialise-0.2.0.0
local-bin-path: __shake-build
work-dir: .stack-work-dhall
> stack install dhall hpack-dhall --stack-yaml=stack-dhall.yaml
> __shake-build/dhall format --inplace default-tests.dhall

Perhaps we could unbundle hpack from stack but then use such tooling if specified for the project by way of a configuration, a tool resolver if you will.