Open monoidal opened 5 years ago
Nice catch! I would lean towards option 2, since runtime reps are supposed to be mostly hidden from users.
Sometime in the 8.10 release cycle, Haddock will add a file-level option show-runtime-reps
which will cause docs for that module to print explicit runtime reps. That option should also carry over to the module's hyperlinked sources. But this makes me think: perhaps Haddock could benefit from a similar option for printing the full multiplicity arguments in linear types too?
Thoughts?
Haddock can show multiple types for an expression, more or less specific (e.g.
id
inid 'a'
isChar -> Char
ora -> a
). Sometimes, the same type is shown twice because ofRuntimeRep
defaulting. Example:With
haddock M.hs --hyperlinked-source --html
, the lastR
in the source is given typeFoo 'LiftedRep
twice. There are two possible fixes:Display both versions correctly. In
recoverFullIfaceTypes
we useshowSDoc df . pprIfaceType
to show the type. Fix: definedf' = gopt_set df Opt_PrintExplicitRuntimeReps
and useshowSDoc df' . pprIfaceType
.Don't display duplicates. Fix: in
Haddock/Backends/Hyperlinker/Renderer.hs
This issue becomes important for linear types. In linear types, every data constructor with at least one argument has Multiplicity arguments (which, like RuntimeReps, are hidden, and cause duplicates).
Using GHC master, haddock commit 65bbdfb6dc1b08f89.