You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to resolve recursive library/test dependencies in Haskell? #34110
0.kind: questionRequests for a specific question to be answered6.topic: haskellGeneral-purpose, statically typed, purely functional programming language
Suppose I have two packages: lib and test-util. The test-util library depends on the lib library and the tests of lib depend on the test-util library. I have created an example of such a project and it works just fine with stack test.
stack2nix (or cabal2nix) produces an expression that separates the dependencies into libraryHaskellDepends and testHaskellDepends but then the builder concatenates everything together and it results in a cycle.
Would it be possible to produce separate derivations for the library and for its tests and then probably combine them into a single derivation to preserve the old behaviour?
changed the title [-]Keep Haskell libraries and tests separately[/-][+]How to resolve recursive library/test dependencies in Haskell?[/+]on Apr 29, 2018
Hm, I’m not sure how this can help, as test-util doesn’t have any tests anyway. It consist only of a library and it is its library that depends on lib.
Okay. Apparently I misunderstood your example. In that case, just do the overrides the other way round. Pass a dontCheck lib version to test-util for the build, then use that to build a tested version of lib.
@peti's trick is indeed the proper short-term solution. But I maintain that in the long term, separate per-component derivations is simplest correct-by-construction way to go.
0.kind: questionRequests for a specific question to be answered6.topic: haskellGeneral-purpose, statically typed, purely functional programming language
Activity
kirelagin commentedon Apr 28, 2018
Bump! Any ideas on how this can be solved?
(@peti)
peti commentedon Apr 29, 2018
You can pass the
libbuild a version oftest-utilthat has its test suite disabled, i.e.This will use an untested version of
test-utilto build a testedlib, and then that version will be used to build a testedtest-util.[-]Keep Haskell libraries and tests separately[/-][+]How to resolve recursive library/test dependencies in Haskell?[/+]kirelagin commentedon May 1, 2018
Hm, I’m not sure how this can help, as
test-utildoesn’t have any tests anyway. It consist only of a library and it is its library that depends onlib.peti commentedon May 4, 2018
Okay. Apparently I misunderstood your example. In that case, just do the overrides the other way round. Pass a
dontCheck libversion totest-utilfor the build, then use that to build a tested version oflib.Ericson2314 commentedon May 4, 2018
@peti's trick is indeed the proper short-term solution. But I maintain that in the long term, separate per-component derivations is simplest correct-by-construction way to go.