ghc-imported-from: Find the Haddock documentation for a symbol.

[ bsd3, development, library, program ] [ Propose Tags ]

Given a Haskell module and symbol, determine the URL to the Haddock documentation for that symbol.


[Skip to Readme]
Versions [faq] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.2.0.0, 0.2.0.1, 0.2.0.2, 0.2.0.3, 0.2.0.4, 0.2.0.5, 0.2.0.6, 0.2.0.7, 0.2.1.0, 0.2.1.1, 0.3.0.0, 0.3.0.1, 0.3.0.2, 0.3.0.3, 0.3.0.4, 0.3.0.5, 0.3.0.6
Dependencies base (==4.6.*), Cabal (>=1.10 && <1.17 || >=1.18), containers (==0.5.0.0), directory, filepath, ghc (==7.6.*), ghc-imported-from, ghc-mod (>=3.1.5), ghc-paths (==0.1.*), ghc-syb-utils, mtl, process, safe, syb (==0.4.*), transformers [details]
License BSD-3-Clause
Author Carlo Hamalainen
Maintainer carlo@carlo-hamalainen.net
Category Development
Home page https://github.com/carlohamalainen/ghc-imported-from
Uploaded by CarloHamalainen at 2014-01-26T20:59:55Z
Distributions NixOS:0.3.0.6
Executables ghc-imported-from
Downloads 11993 total (19 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Successful builds reported [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for ghc-imported-from-0.1.0.2

[back to package description]

ghc-imported-from

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 haddock-url src/Main.hs Main getArgs 160 13

says

SUCCESS: file:///home/carlo/opt/ghc-7.6.3_build/share/doc/ghc/html/libraries/base-4.6.0.1/System-Environment.html

since the usage of getArgs at line 160, column 13, is from the System.Environment module.

Difficulties arise 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.

Preference is given to any locally available Haddock documentation, and then to the generic url at hackage.org.

Beware

You may have to run

cabal build

or

cabal repl

in a project directory to sort out some of the dist/build/autogen files. At the moment ghc-imported-from has no functionality to do this boot process automatically. To run cabal repl you might need the latest Cabal from https://github.com/haskell/cabal.

If you see

<command line>: cannot satisfy -package hspec
    (use -v for more information)

then you may need the hspec and/or doctest packages:

cabal install hspec doctest

Feedback and pull requests most welcome!

Install

ghc-imported-from

Install into ~/.cabal:

git clone https://github.com/carlohamalainen/ghc-imported-from
cd ghc-imported-from
cabal install

Or, install into a sandbox:

git clone https://github.com/carlohamalainen/ghc-imported-from
cd ghc-imported-from
./build_in_sandbox.sh

Either way, ensure that ghc-imported-from is in the current PATH.

ghcimportedfrom-vim

Follow the instructions at https://github.com/carlohamalainen/ghcimportedfrom-vim to install the Vim plugin.

Usage

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):

http://www.youtube.com/watch?v=VVc8uupYJGs