1

The project I am using does not have docs on Stackage (they're out of date). Here is the original one which is on verson 0.3

https://hackage.haskell.org/package/reflex-dom-0.3/docs/Reflex-Dom-Widget-Basic.html

I was told I could generate docs with haddock. I have the source code on my computer (using git clone) version 0.4

The haddock web page was way too advanced.

For the beginner, once I am in my directory, how do I generate docs?


Thanks to one of the answer I made come progress, but here is an error message:

src/Reflex/Dom/Xhr.hs:154:0:
     error: missing binary operator before token "("
     #if MIN_VERSION_aeson(1,0,0)
     ^
john mangual
  • 7,718
  • 13
  • 56
  • 95
  • It's not entirely clear what the problem is. You do not know how to generate the documentation as webpages? Or you have a question how to install it? Or you have a question about a specific feature in haddock? – Willem Van Onsem Mar 23 '17 at 19:10
  • @WillemVanOnsem after I `git clone` what do I type into the shell to generate documentation? – john mangual Mar 23 '17 at 19:20

2 Answers2

5

cabal haddock or stack haddock.

Li-yao Xia
  • 31,896
  • 2
  • 33
  • 56
3

Once you have installed haddock, you can run it as follows:

haddock --html -o <haddock-folder> <list-of-haskell-files>

So for instance:

haddock --html -o the_documentation *.hs

will generate the documentation of all the Haskell files in that directory (not any subdirectories) in a directory named the_documentation.

Some shells allow **.hs to look for all .hs files (subdirectories included). So you might try:

haddock --html -o the_documentation **.hs

If the shell does not suport that, you can of course use a combination of find and xargs, like:

find -iname '*.hs' | xargs haddock --html -o the_documentation

Here find will generate a list of all files that end with .hs, and xargs will write all these files as parameters to haddock --html ....

Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555