Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view Haskell's documentation using Haddock?

For example, how would I view the docs for Data.List.group as I could on hackage?

If I try to use Haddock as:

$ haddock Data.List                                   
<no location info>: error: module ‘Data.List’ is a package module
$ haddock Data.List.group                            
target ‘Data.List.group’ is not a module name or a source file

On the other hand, I know that these html docs exist in my computer under the /usr/local/share/doc directory.

Or am I mistaken and this is not what Haddock does?

like image 357
xrisk Avatar asked Oct 29 '22 16:10

xrisk


1 Answers

The haddock command generates documentation in HTML. To view it you use any web browser by pointing it at the generated file. There should be an index.html file, so you can view it with:

firefox index.html

Update: If you are using Stack then stack haddock will generate the documentation for your project, and also for all the dependencies.

like image 58
Paul Johnson Avatar answered Nov 15 '22 08:11

Paul Johnson