carlohamalainen / ghc-imported-from

For a given Haskell source file, determine where a symbol is imported from
BSD 3-Clause "New" or "Revised" License
26 stars 2 forks source link

Can't handle chained (nested?) imports #4

Closed carlohamalainen closed 10 years ago

carlohamalainen commented 10 years ago

In Yesod there is this:

-- Foundation.hs
getExtra = ...

-- Import.hs
import Foundation as Import
import Blah as Import -- and more like this

So when we ask about getExtra, all we see is [Imports], but there's no documentation at this location, either locally or on hackage:

symbol:  getExtra
symbol': Foundation.getExtra
importlist:     ["Prelude","Debug.Trace","System.FilePath.Posix","Network.Wai","GHC.Int","Text.Blaze.Html.Renderer.Text","Yesod.Default.Config","Control.Monad","Data.Aeson.Types","Data.Yaml","Data.Function","Data.List","Safe","Data.Time.Clock","Data.Time.Calendar","Network.URI","Text.RSS","Data.Text.Lazy","Network.Mail.Mime","Yesod.ReCAPTCHA","Control.Applicative","Data.Maybe","Text.Printf","Data.Text","Database.Persist.Store","Control.Monad","Model","Data.Time","Import"]
importlist':     ["Prelude","Debug.Trace","System.FilePath.Posix","Network.Wai","GHC.Int","Text.Blaze.Html.Renderer.Text","Yesod.Default.Config","Control.Monad","Data.Aeson.Types","Data.Yaml","Data.Function","Data.List","Safe","Data.Time.Clock","Data.Time.Calendar","Network.URI","Text.RSS","Data.Text.Lazy","Network.Mail.Mime","Yesod.ReCAPTCHA","Control.Applicative","Data.Maybe","Text.Printf","Data.Text","Database.Persist.Store","Control.Monad","Model","Data.Time","Import","Foundation"]
smatches: []

Model.hs:22:279: Warning:
In the use of `renderHtml'
(imported from Text.Blaze.Renderer.Utf8):
Deprecated: "Use renderHtml from Text.Blaze.Html.Renderer.Utf8 instead"
file: Handler/Home.hs
module: Handler.Home
supplied symbol: getExtra
inferred symbol: Foundation.getExtra
name: Foundation.getExtra
all imported froms: [Import]
importedFrom: Just Import
ghc-pkg find-module Import --simple-output --global --package-db /home/htest/cli-    yesod-blog-tmp/blog/.cabal-sandbox/i386-linux-ghc-7.6.3-packages.conf.d/
ghcPkgFindModule stdout: blog-0.0.0

ghcPkgFindModule stderr: 
ghcPkgFindModule: Just "blog-0.0.0"
["field","blog-0.0.0","haddock-html","--global","--package-db","/home/htest/cli-yesod-    blog-tmp/blog/.cabal-sandbox/i386-linux-ghc-7.6.3-packages.conf.d/"]
"haddock:"
Just "/home/htest/cli-yesod-blog-tmp/blog/.cabal-sandbox/share/doc/i386-linux-ghc-    7.6.3/blog-0.0.0/html"
"m':"
Just "blog-0.0.0"
SUCCESS: /home/htest/cli-yesod-blog-tmp/blog/.cabal-sandbox/share/doc/i386-linux-ghc-7.6.3/blog-0.0.0/html/Import.html
carlohamalainen commented 10 years ago

Solution is to explicitly import the underlying package. Hopefully this isn't too common a problem.