Commit b1bc9417 authored by Brent Yorgey's avatar Brent Yorgey Committed by tibbe

cabal init: improve error reporting when generating build-depends

This patch contains two improvements:
  1. Don't generate multiple warnings when the same module is
     imported multiple times.
  2. Get rid of spurious warnings about modules that could not be
     found, when those modules are in fact provided by the very
     package we are generating a .cabal file for.
parent 2acbf37d
......@@ -307,7 +307,14 @@ getModulesBuildToolsAndDeps pkgIx flags = do
deps <- return (dependencies flags)
?>> Just <$> importsToDeps flags
(fromString "Prelude" : concatMap imports sourceFiles)
(fromString "Prelude" : -- to ensure we get base as a dep
( nub -- only need to consider each imported package once
. filter (`notElem` mods) -- don't consider modules from
-- this package itself
. concatMap imports
$ sourceFiles
)
)
pkgIx
return $ flags { exposedModules = Just mods
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment