<div dir="ltr"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>> cabal-install: it does not work well with packages that have flags<br>
> because it does not know what flags to use when building dependencies.<br>
> Really, packages with conditionals are different packages in one<br>
> cabal file.<br>
<br>
</div>Packages are not supposed to expose different APIs with different flags<br>
so I don't think that's right. Under that assumption cabal-install can<br>
in principle resolve everything fine. I'm not claiming the current<br>
resolution algorithm is very clever when it comes to picking flags<br>
(though it should always pick ones that give an overall valid solution)<br>
but there is certainly scope for a cleverer one. Also, the user can<br>
always specify what features they want, which is what systems like<br>
Gentoo do.<br>
<br>
Do you have any specific test cases where the current algorithm is less<br>
than ideal? It'd be useful to report those for the next time someone<br>
hacks on the resolver.<br></blockquote></div><br>I have a package that builds a library and a test executable. The test executable uses QuickCheck 2, but I don't want to force random Jane who cabal-installs my package to install QuickCheck 2. One, it's not packaged up, and two, it's not necessary for using the library. The cleanest way I found to deal with this is to use a flag for hiding the build-depends of the test executable for the flag-less build.<br>
<br> <span style="font-family: courier new,monospace;">if flag(test)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> build-depends: QuickCheck >= 2.0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> else</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> buildable: False</span><br><br>Sean<br>
</div>