Use Cabal V2 instead of Stack
With Cabal v2 it is possible to build Stack projects and also Cabal projects, so it would make sense to drop the hard dependency on stack.
Advantages
- possible to Flatpak Stack and Cabal projects, making it more useful for the wider Haskell community
- can drop the requirement of downloading and caching package hashes, as cabal provides sha256 hashes for the sources
- no longer tied to commercialhaskell's stack infrastructure or their build system
- it simplifies stackpak overall
Possible Implementation (WIP)
Stackpak would need to do the following:
- run
cabal new-build --dry-run
to generatedist-newstyle/cache/plan.json
for the project - parse the generated plan.json and calculate the build order OR use
cabal-plan info
and parse the output
Most files will need to be modified as a lot of things are stack-specific.
Main.hs
, Urls.hs
, Paths.hs
have many stack-specific functions that will no longer be needed and could be removed. ProjectInformation.hs
would need to contain cabal specific project information.
The dependency resolver can be re-used with small modifications to resolve the dependency order from the cabal plan.json
. GeneratorInput.hs
and Generator.hs
could largely be reused with minor changes.
The following files could be removed, but a new Package record should be created instead of PackageYaml.hs which would be required elsewhere.
- src/Stack/LtsYaml.hs
- src/Stack/PackageYaml.hs
- src/Stack/Stack.hs
- src/Stack/StackLsDependency.hs
- src/Stack/StackYaml.hs
TODO
What needs to be figured out is:
- where/how does Cabal download GHC
- does Cabal store sha256 hashes for GHC binaries somewhere? if so, we can use that.
- where/how does Cabal download source packages
- how Cabal V2 works in general
Other
- rename the project to something else, as it no longer depends on stack (Haskellpak?)
- provide a release on Hackage once implemented #5