Questions tagged [haddock]

Haddock is a documentation generator for Haskell

129 questions
41
votes
2 answers

Literate Haskell (.lhs) and Haddock

At the moment I'm only using Haddock but after seeing some really interesting examples (e.g. this gist) of literate Haskell, I'm interested in trying it out in a project. The questions I got, are: What do you write as Haddock comments and what do…
finnsson
  • 4,037
  • 2
  • 35
  • 44
41
votes
1 answer

What does a Haskell comment starting with `{- |` generally mean?

I see Haskell multi-line comments that sometimes start with {- | instead of just {-. Does leading with the pipe character inside the comment mean something by convention?
dan
  • 43,914
  • 47
  • 153
  • 254
35
votes
2 answers

Generating documentation for my own code with Haddock and stack

I have annotated my code in Haddock style and would like to generate browse-able documentation. Since I am also using stack, I want to integrate the documentation generation into the workflow. However, I have not yet been able to generate anything…
Sam van Herwaarden
  • 2,321
  • 14
  • 27
31
votes
1 answer

Haddock numbered list continuation

How to continue a numbered list with haddock documentation tool? The following lines in haddock -- 1. First line. -- -- 2. Second line with instructions to do something -- -- >>> command-linecmd param -- -- 3. Third line.. -- generate…
Gspia
  • 809
  • 6
  • 15
26
votes
1 answer

Haddock, Cabal: How to include source code examples?

I am the author of the operational package, which includes example code. I would like this example code to be hscolored and installed together with the API documentation, which is generated by Haddock. I probably have to use a custom Cabal build…
Heinrich Apfelmus
  • 11,034
  • 1
  • 39
  • 67
26
votes
3 answers

How to embed images in Haddock documentation

How can I embed images within local Haddock documentation? I see for example the lens package just uses external links to images, but I'd like to store the images locally. (This question is very similar to an (unanswered) question on the mailing…
amindfv
  • 8,438
  • 5
  • 36
  • 58
21
votes
3 answers

Enable --hyperlink-source for "cabal install"

The command cabal haddock has very useful --hyperlink-source option. I would like to have the source hyperlinked when building documentation with cabal install. The ticket #517 seems to be just about it:…
Tener
  • 5,280
  • 4
  • 25
  • 44
17
votes
4 answers

Can links to anchors in haddock be labeled?

When linking to a URL, one can provide a label that specifies what the reader will see; for example, will have "haskell" for the link text. Unfortunately the documentation does not provide an obvious way to label…
Gregory Crosswhite
  • 1,457
  • 8
  • 17
16
votes
2 answers

How are the Haddock module fields Portability, Stability and Maintainer used?

In lots of Haddock-generated module documentation (e.g. Prelude), a small box in the top-right can be seen, containing portability, stability and maintainer information: From looking at the source code to such modules and experimentation, I…
ehird
  • 40,602
  • 3
  • 180
  • 182
16
votes
2 answers

what is the meaning of "let x = x in x" and "data Float#" in GHC.Prim in Haskell

I looked at the module of GHC.Prim and found that it seems that all datas in GHC.Prim are defined as data Float# without something like =A|B, and all functions in GHC.Prim is defined as gtFloat# = let x = x in x. My question is whether these…
TorosFanny
  • 1,702
  • 1
  • 16
  • 25
14
votes
1 answer

Why is the Haddock documentation not showing up on Hackage?

I've got a package on Hackage that has haddock generated documentation but it isn't showing up on the Hackage page. I'm able to upload everything successfully but the documentation doesn't show up. I generate the documentation with cabal haddock or…
Trystan Spangler
  • 1,685
  • 11
  • 20
13
votes
1 answer

How do I get a "Style" menu in my Haddock documentation?

Some packages (the Haddock documentation for example Data.String.Utils) have a menubar that includes a "Style" menu that allows choosing among styles used to display the documentation: How do I get this menu in the documentation for my own…
orome
  • 45,163
  • 57
  • 202
  • 418
12
votes
1 answer

Is there any way to describe function parameters first in Haddock?

Typical Haddock syntax allow to write something like this -- Initializes local variables so arrays will get defined -- -- Defer initialization context inside a compound type. -- initialize :: Bool -- ^ 1st parameter description ->…
sigrlami
  • 1,822
  • 1
  • 17
  • 35
10
votes
1 answer

how to use hoogle locally (like ctags)?

I want to use Hoogle locally, so I can run search queries on one of my projects. There's some documentation [ here ], but I can't figure out how to get it to work. It says to run Haddock, but haddock doesn't give any output, only spitting out the…
gatoatigrado
  • 16,580
  • 18
  • 81
  • 143
10
votes
1 answer

How do I customize Haddock document generation, for all packages?

It's not clear to me how to customize the documents that cabal haddock generates. For example how do I include source links, or use a custom CSS file so that they apply in all cases? In my ~/.cabal/config I've tried haddock -- keep-temp-files:…
orome
  • 45,163
  • 57
  • 202
  • 418
1
2 3
8 9