$ whoami
In 2002, Simon Marlow started Haddock.
[haddock @ 2002-04-04 16:23:43 by simonmar]
This is Haddock, my stab at a Haskell documentation tool. It's not
quite ready for release yet, but I'm putting it in the repository so
others can take a look.
It uses a locally modified version of the hssource parser, extended
with support for GHC extensions and documentation annotations.
├── html
│ └── haddock.css
├── LICENSE
├── Makefile
├── mk
│ ├── boilerplate.mk
│ ├── config.mk
│ ├── target.mk
│ └── version.mk
├── README
├── src
│ ├── HaddockDB.hs
│ ├── HaddockHtml.hs
│ ├── HaddockLex.hs
│ ├── HaddockTypes.hs
│ ├── HaddockVersion.hs
│ ├── HsLexer.lhs
│ ├── HsParseMonad.lhs
│ ├── HsParser.ly
│ ├── HsParseUtils.lhs
│ ├── HsSyn.lhs
│ ├── Main.hs
│ └── Makefile
└── TODO
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Haskell 10 463 264 2084
CSS 1 15 0 96
make 6 23 37 32
-------------------------------------------------------------------------------
SUM: 17 501 301 2212
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Haskell 55 2625 2822 16308
JSON 3 0 0 10408
CSS 5 451 101 1819
TypeScript 5 128 122 820
JavaScript 4 7 2 50
Markdown 3 28 0 43
TeX 1 13 18 26
-------------------------------------------------------------------------------
SUM: 76 3252 3065 29474
Synchronisation workflow during development was tedious Some GHC bindists were published with an innapropriate submodule commit
Now I’m going to talk about some problematic stuff within Haddock, which is important, in order to understand what are the opportunities for improvement.
We can’t slap you on the wrist if you end up producing more than one
<h1>
tags in your documentation. More generally, the
h1 > h2 > h3 cannot really be enforced.
… But screen readers don’t love them as much
© Sonmez Karakurt
The diagrams are going to be extremely confusing because screen readers will spell each single characters. Imagine suddenly you hear: “Box Drawings Light Arc Down and Right”, “Box Drawings Light Horizontal”, etc etc.
Some of you will see th mistake I made when writing down the characters that make up this table. Those of you who didn’t will be told in the most cryptic way.
-- | This is a grid table:
--
-- +------------------------+------------+----------+----------+
-- | Header row, column 1 | Header 2 | Header 3 | Header 4 |
-- +======================+============+==========+==========+
-- | body row 1, column 1 | column 2 | column 3 | column 4|
-- +----------------------+------------+----------+----------+
-- | body row 1, column 1 | column 2 | column 3 | column 4|
-- +----------------------+------------+----------+----------+
module Main where
<no location info>: error:
Data.Text.Internal.Fusion.Common.index: Index too large
CallStack (from HasCallStack):
error, called at libraries/text/src/Data/Text/Internal/Fusion/Common.hs:1189:24 in text-2.0.2:Data.Text.Internal.Fusion.Common
streamError, called at libraries/text/src/Data/Text/Internal/Fusion/Common.hs:1089:33 in text-2.0.2:Data.Text.Internal.Fusion.Common
indexI, called at libraries/text/src/Data/Text/Internal/Fusion.hs:249:9 in text-2.0.2:Data.Text.Internal.Fusion
index, called at libraries/text/src/Data/Text.hs:1951:13 in text-2.0.2:Data.Text
index, called at utils/haddock/haddock-library/src/Documentation/Haddock/Parser.hs:464:17 in haddock-2.29.2:Documentation.Haddock.Parser
Silent and counter-intuitive behaviours: I really love when my tables don’t get rendered because they are at the top of a module’s documentation. Automatic link checking: HTTP 404s, missing files on disk
@since
annotationsDocumentation is a discipline for which we are given tools, both conceptual and concrete. Let’s examine some of them.
Write down initial ideas, user needs, the ideal documentation that you’d like users to read. Survey potential on the ergonomics and features. Take notes of ideas that you rejected and why, so that people understand the trajectory Confront your documentation to the world, fill the gaps
Understand the stability of your documentation.
As opposed to the stable documentation, you will have to use some specialised tools to ensure that volatile documentation stays relevant at all times
“When you refer to something, make sure the direction of the reference is from the more volatile to the more stable elements”
— Cyrille Martraire, Living Documentation, 2019
(Simplified model)
Haddocks of a third-party library ├──> Official specs ├──> Architecture Document └─┬> Haddocks of a core library (base, text, vector, etc) ├──> GHC Manual ├──> Official specs └──> Papers (without paywalls)
Diátaxis is an empirical documentation model crafted around the needs of documentation users. It uses four quadrant, which represent a pairing of action (up), cognition (down), acquisition (left) and application (right).
Expose the relationships between the components of your software. Calligraphy is a call graph visualizer that works with HIE files. You can have it show or hide modules, classes, types, function calls.
“for each desired change, make the change easy (warning: this may be hard), then make the easy change”
– Kent Beck
We collaborated with Chris Done to make lucid2
appropriate for generating HTML5 (HPC will also benefit from this). We
will collaborate with UI developers to provide an optimal experience on
mobile devices, provide extension points in the design, and improve the
ergonomics with edge cases.
Edge cases: freakishly huge type signatures
HTML5
CSS3
Accessibility
Maintainability
We want to have metaprogramming, in order to get an extensible system. Traversal of the document to produce backward and forward references. (Sebastian, you and I are going to talk :)
Bring your own syntax! Mermaid diagrams have been growing in popularity these past years. GHC Notes also are a fantastic treasure trove of knowledge. They should be indexed and easily reachable.
Interactive tutorials with side-by-side steps, and highlighted code. (Swift’s DocC)
module Manual where
import Haddock.Genre.Manual (manual)
import My.Module (ident)
main = [manual|
---
title = "My fantastic document" -- Mandatory metadata
author = "The Document Team"
---
# Relative top-level header
---
id = top-level -- Section metadata, user-provided, guaranteed to be globally unique
---
## Relative second level header
Link to an in-scope identifier with `{ref ident}`.
Link to an out-of-scope identifier with `{ref Manual.Chapter2.chapter2}`
Print an in-scope identifier in a human-readable way {ident}. `This is inline code`
The entry point of the package is: {ref sendMissiles}
{docstring sendMissiles}
|]
module Manual where
import Haddock.Genre.Manual (manual)
import Haddock.Syntax.Mermaid (mermaid)
main = [manual|
---
title = "Architecture Diagram" -- Mandatory metadata
---
```mermaid
flowchart TD
node_0[Documentation.Haddock.Types]
node_100[Documentation.Haddock.Parser.Monad]
node_127[Documentation.Haddock.Parser.Util]
node_138[Documentation.Haddock.Parser.Identifier]
node_100 --> node_0
node_127 --> node_100
node_138 --> node_0
[…]
```
|]
Quality Assurance: If you have a Windows or macOS computer, we’re interested! Release engineering: Ticket triaging, nightly releases, benchmarks CI!
#ghc:matrix.org
&
#haddock:matrix.org