From 8358272046196003f9b6c2cdfb2bf698cdddef91 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Fri, 18 Sep 2015 22:08:31 +0000 Subject: doc: update haskell-users-guide.xml with ghcWithHoogle stuff --- doc/haskell-users-guide.xml | 84 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'doc') diff --git a/doc/haskell-users-guide.xml b/doc/haskell-users-guide.xml index 87c8e1b92ddb..2f3b1eabb11d 100644 --- a/doc/haskell-users-guide.xml +++ b/doc/haskell-users-guide.xml @@ -354,6 +354,90 @@ if [ -e ~/.nix-profile/bin/ghc ]; then fi +
+ How to install a compiler with libraries, hoogle and documentation indexes + + If you plan to use your environment for interactive programming, + not just compiling random Haskell code, you might want to + replace ghcWithPackages in all the listings + above with ghcWithHoogle. + + + This environment generator not only produces an environment with + GHC and all the specified libraries, but also generates a + hoogle and haddock indexes + for all the packages, and provides a wrapper script around + hoogle binary that uses all those things. A + precise name for this thing would be + "ghcWithPackagesAndHoogleAndDocumentationIndexes", + which is, regrettably, too long and scary. + + + For example, installing the following environment + + +{ + packageOverrides = super: let self = super.pkgs; in + { + myHaskellEnv = self.haskellPackages.ghcWithHoogle + (haskellPackages: with haskellPackages; [ + # libraries + arrows async cgi criterion + # tools + cabal-install haskintex + ]); + }; +} + + + allows one to browse module documentation index not + too dissimilar to this for all the specified packages and + their dependencies by directing a browser of choice to + ~/.nix-profiles/share/doc/hoogle/index.html + (or + /run/current-system/sw/share/doc/hoogle/index.html + in case you put it in + environment.systemPackages in NixOS). + + + After you've marveled enough at that try adding the following to + your ~/.ghc/ghci.conf + + +:def hoogle \s -> return $ ":! hoogle search -cl --count=15 \"" ++ s ++ "\"" +:def doc \s -> return $ ":! hoogle search -cl --info \"" ++ s ++ "\"" + + + and test it by typing into ghci: + + +:hoogle a -> a +:doc a -> a + + + Be sure to note the links to haddock files in + the output. With any modern and properly configured terminal + emulator you can just click those links to navigate there. + + + Finally, you can run + + +hoogle server -p 8080 + + + and navigate to for + your own local Hoogle. + Note, however, that Firefox and possibly other browsers disallow + navigation from http: to + file: URIs for security reasons, which might + be quite an inconvenience. See this + page for workarounds. + +
How to create ad hoc environments for <literal>nix-shell</literal> -- cgit 1.4.1