BSD3 licensed by Carlo Hamalainen
Maintained by

Module documentation for


For a given Haskell source file, determine the path to the Haddock documentation for a symbol at a particular line/col location.

Example: on the file src/Main.hs,

ghc-imported-from src/Main.hs Main strOption 18 17


SUCCESS: file:///home/carlo/.stack/snapshots/x86_64-linux/lts-5.8/7.10.3/doc/optparse-applicative-

since the usage of strOption at line 18, column 17, is from the Options.Applicative.Builder module.

Difficulties arise in resolving names because some symbols are exported from a certain package but defined in another, for example String is defined in GHC.Base but is exported from the standard prelude, the module Prelude. There are other cases to deal with including qualified imports, selective imports, imports with hidden components, etc.

Using with Stack

Stack makes everything easier.

Build ghc-imported-from:

git clone
cd ghc-imported-from
stack build

then add


or similar to your $PATH.

Then in a project that you are working on:

cd my-project
stack build
stack haddock # Must do this!
ghc-imported-from some/file/Blah.hs Blah f 100 3


Run the tests using Stack:

stack test


For Vim users, follow the instructions at to install the Vim plugin.


For Emacs users, David Christiansen has written ghc-imported-from-el.


See the tests subdirectory for some examples. Or load your favourite Haskell project and hit F4.

Or watch the screencast (be sure to set 720p HD and then fullscreen):


ghc-imported-from uses both GHC and ghc-pkg, which accept arguments in differing formats. For example GHC takes -package-db while ghc-pkg takes --package-db=. For more details:


To see the GHC options that have been automatically detected, change into your project’s directory and run:

$ cd ~/ghc-imported-from
$ cabal repl --with-ghc=fake-ghc-for-ghc-imported-from
Preprocessing library ghc-imported-from-
--interactive -fbuilding-cabal-package -O0 -outputdir dist/build -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -i. -idist/build/autogen -Idist/build/autogen -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h -package-name ghc-imported-from- -hide-all-packages -no-user-package-db -package-db /home/user/ghc-imported-from/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d -package-db dist/package.conf.inplace -package-id Cabal-1.16.0-c6e09e008cd04cf255c1ce0c59aba905 -package-id base- -package-id containers- -package-id directory- -package-id filepath- -package-id ghc-7.6.3-18957ddbb817289f604552aa2da2e879 -package-id ghc-mod-4.1.0-a87501f2667239b3f0bef3e0f3753496 -package-id ghc-paths- -package-id ghc-syb-utils- -package-id mtl- -package-id process- -package-id safe-0.3.4-ba52ca348aecad429ba90450e3aba4c4 -package-id syb-0.4.1-9469ffdd9c6a7ebbf035421c915a08ee -package-id transformers- -XHaskell2010 Language.Haskell.GhcImportedFrom Language.Haskell.GhcImportedFrom.UtilsFromGhcMod Language.Haskell.GhcImportedFrom.Types -Wall


As far as I know the only alternative is the fpco/hoogle-doc function in Or try Ctrl-i in the web version of FP Complete.


2016-06-01 v0.3.0.6

  • Bugfix - remove duplicates from result of qualifiedNames.

2016-04-12 v0.3.0.5

  • Remove upper bound on pipes-transduce.

2016-04-05 v0.3.0.4

  • Bugfix: upper bound on pipes-transduce to fix a build error.

2016-04-04 v0.3.0.3

  • Bugfix: was parsing stderr instead of stdout for some ‘stack path’ commands.
  • Build against process-streaming- instead of process-streaming-

2016-03-30 v0.3.0.2

  • Bugfix to the bugfix.

2016-03-30 v0.3.0.1

  • Bugfix: use process-streaming to avoid deadlock on Fedora 23.

2016-03-26 v0.3.0.0

  • New heuristics for resolving symbols.
  • Compatability with Stack!

2016-01-20 v0.2.1.1

  • Builds against ghc-mod-

2016-01-20 v0.2.1.0

  • Builds on GHC 7.10.3 with the latest version of ghc-mod that is available on Hackage.

2015-08-17 v0.2.0.7

  • Added a fall-back case when our resolved qualified name does not match anything.

2014-07-05 v0.2.0.6

  • Use optparse-applicative for argument parsing.
  • Allow digits and underscores in module names.

2014-06-01 v0.2.0.5

  • Version bound on ghc-mod.

2014-05-22 v0.2.0.4

  • Speedup: factor out calls to getGhcOptionsViaCabalRepl.
  • Bug fix: filter out haskell module names from the cabal options list.

2014-05-19 v0.2.0.3

  • Fixed test cases.
  • Added alternative heuristic for lookup.

2014-05-16 v0.2.0.2

2014-05-15 v0.2.0.1

  • Link to

2014-05-15 v0.2.0.0

  • Builds with GHC 7.6.3 and 7.8.2.
  • Reduced dependencies on ghc-mod and Cabal internals.
  • GHC option discovery using a fake GHC binary.
  • Various tidyups via hlint.
  • Removed cabal constraints file.

2014-05-02 v0.1.0.4

2014-03-03 v0.1.0.3

  • Fix build failure by pinning all package dependencies.

2014-01-26 v0.1.0.2

  • Use more of ghc-mod’s API to set the correct GHC command line arguments.

2014-01-24 v0.1.0.1

  • Change module layout to Language.Haskell.GhcImportedFrom to comply with guidelines.

2014-01-21 v0.1.0.0

  • First version on
comments powered byDisqus