Haskell offline documentation?

前端 未结 9 1884
一整个雨季
一整个雨季 2021-01-30 01:13

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

9条回答
  •  粉色の甜心
    2021-01-30 02:00

    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
    

提交回复
热议问题