-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ambiguous modules #119
Comments
This fixes #35. The upstream issue is sol/doctest#119.
It would definitely be nice to fix this as we'll run across this more and more as the number of packages grow. I've assumed it to be hard although I don't really know :) Would it work to pass I'm currently pointing people to https://github.com/bergmark/blog/blob/master/2016/package-faq.md#ambiguous-modules-when-using-doctest which doesn't really contain a solution. |
Personally I would much rather see these kinds of problems solved by That way not only |
I want to emphasize the importance of this issue. Crux of the issueGiven doctest GHC invocation uses all the packages installed in a machine, if for any reason any developer or CI machine is working in multiple projects with dependencies that share the same module names (e.g. ImplicationsCurrently, there are around 400 duplicated modules in the Using doctest makes your test infrastructure dependant on environmental dependencies, and what combination of projects/branches you are currently working in the same machine. Possible solutionsThe ideal solutionDo something similar to what stack does:
A "manual" solutionSpecify on a config file all the dependencies you want to have in the project, no need to have cabal as a dependency, but (likely) you'll have your dependencies listed in different sources of truth. Other solutions?The list above is not exhaustive, feel free to keep adding suggestions around what we can do. Thanks! |
cabal-doctest does this already. It's a hack but there aren't any non-hacky solutions presently, and it has the high virtue of working like a charm right now and the even higher virtue of being easy to rip out once there's a proper solution. haskell/cabal#4500 is where we've been tossing around some ideas for giving Cabal the smarts to invoke doctest itself with all the necessary information, but it's still on the whiteboard (contributions welcome, of course). |
commercialhaskell/stack#4652 fixes this issue in Stack's |
In GetShopTV/swagger2#15 the tests are failing because of an "ambiguous module name" error raised by
doctest
. The reason seems to be thatdoctest
is looking in the whole stack snapshot instead of looking only for packages specified in.cabal
file.This can be fixed in the package with
PackageImports
and in that particular case only one import needs that. But still it feels wrong to protect imports that should be okay otherwise.Is there an option or something to prevent this ambiguity somehow? Or should there be?
The text was updated successfully, but these errors were encountered: