Daniel.T
Daniel.T

Reputation: 23

Nested git dependencies when using Stack (Haskell)

I have two Haskell libraries lib-a and lib-b, both hosted on private git repos. lib-b depends on lib-a, both build with no problem. Now i want to import lib-b into another project and thus add it to the stack configuration with the git directive, like this:

- git: [email protected]:dataO1/lib-b.git
  commit: deadbeef102958393127912734

Stack still seems to need a specific version for lib-a:

In the dependencies for application-0.1.0.0:
    lib-a needed, but the stack configuration has no specified version (no package with that name found,
            perhaps there is a typo in a package's build-depends or an omission from the stack.yaml packages
            list?)
needed due to application-0.1.0.0 -> lib-b-0.1.0.0

The question now is, can stack somehow figure out specific versions for nested git dependencies without explicitely specifying them? If the project grows i dont want to manually adjust this every time i update lib-a.

Sidenote: I'm using nixOS and the nix directive for all three stack projects.

Upvotes: 1

Views: 102

Answers (1)

fghibellini
fghibellini

Reputation: 695

Stack follows the snapshot-based model of package management, meaning that it has some "globally" specified set of packages (of fixed version) that you can use. In Stack's case this set of packages is called Stackage. The core idea is to have this clearly specified set of packages that you're working with.

So the short answer is no it cannot figure it out by itself, you have to add them by hand.

But! you need to specify only packages that are not in the snapshot. e.g. package lib-a is likely to depend on mostly packages that are commonly used in Haskell (e.g. base, aeson, ...) and those will already be in Stackage. so even if the project grows you will be adding just "a few" git refs.

So this doesn't generally tend to be a problem.

Upvotes: 0

Related Questions