What are the possibilities, if any, for getting offline docs for Haskell core libraries (and maybe more)?
Sometimes I take my laptop to the coffee-shop where there is no wifi, and it would be nice having something like Hoogle but for offline use.
What are the possibilities, if any, for getting offline docs for Haskell core libraries (and maybe more)?
Sometimes I take my laptop to the coffee-shop where there is no wifi, and it would be nice having something like Hoogle but for offline use.
Hoogle is available offline, installable from Cabal: http://hackage.haskell.org/package/hoogle
Usage instructions are at http://www.haskell.org/haskellwiki/Hoogle#Command_Line_Search_Flags.
Usage:
$ hoogle --help
Hoogle v4.2.8, (C) Neil Mitchell 2004-2011
http://haskell.org/hoogle
hoogle [COMMAND] ... [OPTIONS]
Commands:
[search] Perform a search
data Generate Hoogle databases
server Start a Hoogle server
combine Combine multiple databases into one
convert Convert an input file to a database
test Run tests
dump Dump sections of a database to stdout
rank Generate ranking information
log Analyse log files
Common flags:
-? --help Display help message
-V --version Print version information
-v --verbose Loud verbosity
-q --quiet Quiet verbosity
Create a default database with hoogle data
(more info at http://neilmitchell.blogspot.com/2008/08/hoogle-database-generation.html).
EDIT: A session of usage after installing Hoogle locally:
$ hoogle
No query entered
Try --help for command line options
$ hoogle data
(downloads databases...takes a few minutes)
I ran into an error here...apparently it is related to the version of Cabal, so I updated that (http://hackage.haskell.org/trac/hackage/ticket/811). That didn't help, so I ran hoogle data all
, which I canceled since it was taking so long (it seems to go through every package on Hackage). It still wouldn't allow a query like hoogle map
but did allow hoogle map +base
(i.e. restrict the search to the base
package) Hopefully it works for you!
EDIT2: This seems to fix the problem (for me):
$cd .cabal/share/hoogle-4.2.8/databases
$hoogle combine base.hoo
$hoogle foldl\'
Data.List foldl' :: (a -> b -> a) -> a -> [b] -> a
Data.Foldable foldl' :: Foldable t => (a -> b -> a) -> a -> t b -> a
The HTML documentation can be downloaded as .tar.bz2
from the Haskell website:
https://downloads.haskell.org/~ghc/latest/docs/
I just downloaded https://www.haskell.org/ghc/docs/7.6.3/libraries.html.tar.bz2 and it's exactly what I've been hoping for.
There are also other options, such as Dash and Zeal, and see also that reddit thread.
If you install the Haskell Platform it includes the GHC docs and the GHC library docs (which cover the core libraries). On Windows they are on the Start Menu under "All Programs|Haskell Platform".
Edit your ~/.cabal/config file. Look for the line (probably commented out) that says documentation: False
. Change that line to documentation: True
and uncomment it. Now when you build projects with cabal install
documentation will also be built and saved locally.
Look around a little more in that same config file and you'll find things options like doc-index-file, docdir, datadir, prefix, etc that allow you to configure where the documentation is stored.
It may not be "canonical" per se, but i believe that the most useful option is a docset software like dash(OS X)/zeal + generated docsets. This way you'll get the search for free and also will have an option to build your custom docsets. It's no problem to get the 'base' package haddock documentation with either of the projects out of the box. You can build custom docsets with haddocset or dash-haskell. Also it integrates nicely with emacs/vim/other editors, allows you to have project-based docsets(you'll have the relevant versions on a per-project basis this way, forget all this hassle with local hoogle!) and don't restrict you to any build flow you can have.
If you build your project with cabal-install
you can set documentation: True
in your ~/.cabal/config
, then reinstall dependencies to get generated haddocks locally.
If you're using stack, you can utilize stack haddock
command to build your dependencies and project with generated haddocks.
I use devdocs.io, it has docs for a lot of languages and libraries (including Haskell) and has an offline mode.
Velocity is a free and beautiful universal tool to do just that. It supports a wide range of languages, technologies and libraries, and one click updating.
You will probably be able to find more of what you are already using in its documentation list.
For Windows, install cygwin's wget and curl packages. That will enable hoogle data
.
If you happen to be using a Debian derived distribution and their packages, then you will find the combined documentation of all installed Haskell packages (if you also install the libghc-foo-doc
packages) at
file:///usr/share/doc/ghc-doc/html/libraries/index.html
Furthermore, the libghc-foo-doc
packages contain the necessary files for hoogle, so if you apt-get install hoogle
, then you should immediately be able to use hoogle
to search through all libraries installed this way.