2
votes

I use Stack to build on my local machine, but Homebrew uses Cabal. This means that sometimes a build will work fine for me, but then not work in Homebrew. This seems to be because Cabal uses the latest packages, whereas Stack uses the ones from the resolver.

Is there a way to generate the package versions in the .cabal file automatically based on the current resolver? (I'm using a package.yaml file)

1
Checkout stack sdist --pvp-bounds: fpcomplete.com/blog/2015/09/stack-pvp - sjakobi
Hadn't thought of creating a tarball then extracting it to get the cabal file. That could work. My build script needs rewriting properly in any case. Not a perfect solution, but can probably get it to work. - Small Hadron Collider

1 Answers

1
votes

In FreeBSD Ports (which is alike Homebrew, AFAIK) we force cabal to use fixed versions of dependencies by fetching and unpacking them in the package directory and then calling cabal new-build. It also uses hpack to generate .cabal file from package.yaml. However, the dependencies list is generated manually by tweaking versions until the package builds successfully.