aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends
Commit message (Collapse)AuthorAgeFilesLines
* Enable two warnings (#1245)tomjaguarpaw2020-12-082-0/+2
| | | | | because they will be soon be added to -Wall. See https://gitlab.haskell.org/ghc/ghc/-/issues/15656
* Add dangling changes from branches ghc-8.6 and ghc-8.8 (#1243)Xia Li-yao2020-12-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix multiple typos and inconsistencies in doc/markup.rst Note: I noticed some overlap with #1112 from @wygulmage and #1081 from @parsonsmatt after creating these proposed changes - mea culpa for not looking at the open PRs sooner. * Fix #1113 If no Signatures, no section of index.html * Change the formatting of missing link destinations The current formatting of the missing link destination does not really help user to understand the reasons of the missing link. To address this, I've changed the formatting in two ways: - the missing link symbol name is now fully qualified. This way you immediately know which haskell module cannot be linked. It is then easier to understand why this module does not have documentation (hidden module or broken documentation). - one line per missing link, that's more readable now that symbol name can be longer due to qualification. For example, before haddock was listing missing symbol such as: ``` could not find link destinations for: Word8 Word16 mapMaybe ``` Now it is listed as: ``` could not find link destinations for: - Data.Word.Word8 - Data.Word.Word16 - Data.Maybe.mapMaybe ``` * Add `--ignore-link-symbol` command line argument This argument can be used multiples time. A missing link to a symbol listed by `--ignore-link-symbol` won't trigger "missing link" warning. * Forbid spaces in anchors (#1148) * Improve error messages with context information (#1060) Co-authored-by: Matt Audesse <matt@mattaudesse.com> Co-authored-by: Mike Pilgrem <mpilgrem@users.noreply.github.com> Co-authored-by: Guillaume Bouchard <guillaume.bouchard@tweag.io> Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
* Add support for custom section anchors (#1179)Iñaki2020-04-251-1/+7
| | | | | | | | | | | | This allows to have stable anchors for groups, even if the set of groups in the documentation is altered. The syntax for setting the anchor of a group is -- * Group name #desiredAnchor# Which will produce an html anchor of the form '#g:desiredAnchor' Co-authored-by: Iñaki García Etxebarria <git@inaki.blueleaf.cc>
* Disallow links in section headersAlec Theriault2020-03-281-1/+1
| | | | | | | | | | | | | This is quite straightforward to implement, since we already had a function `docToHtmlNoAnchors` (which we used to generate the link in the sidebar "Contents"). This breaks test `Bug387`, but that test case has aged badly: we now automatically generate anchors for all headings, so manually adding an anchor in a section makes no sense. Nested anchors are, as pointed out in #1054, disallowed by the HTML standard. Fixes #1054
* Use `unLoc`/`noLoc` from GHC instead of `unL`/`reL`Alec Theriault2020-03-283-15/+15
| | | | | | | | * `unL` is already defined by GHC as `unLoc` * `reL` is already defined by GHC as `noLoc` (in a safer way too!) * Condense `setOutputDir` and add a about exporting from GHC Fixes #978
* Use TTG empty extensions to remove some `error`'sAlec Theriault2020-03-282-3/+5
| | | | | | | | | | | None of these error cases should ever have been reachable, so this is just a matter of leveraging the type system to assert this. * Use the `NoExtCon` and `noExtCon` to handle case matches for no extension constructors, instead of throwing an `error`. * Use the extension field of `HsSpliceTy` to ensure that this variant of `HsType` cannot exist in an `HsType DocNameI`.
* Remove unused `Haddock.Utils` functionsAlec Theriault2020-03-281-0/+4
| | | | | | | * removed functions in `Haddock.Utils` that were not used anywhere (or exported from the `haddock-api` package) * moved GHC-specific utils from `Haddock.Utils` to `Haddock.GhcUtils`
* Tentative 2.24 releaseAlec Theriault2020-03-221-1/+1
| | | | | Adjusted changelogs and versions in `.cabal` files in preparation for the upcoming release bundled with GHC 8.10.
* Clean up warningsAlec Theriault2020-03-224-12/+3
| | | | | | * unused imports * imports of `Data.List` without import lists * missing `CompatPrelude` file in `.cabal`
* Merge branch 'ghc-8.8' into ghc-8.10Alec Theriault2020-03-2010-263/+346
|\
| * Replace the 'caption' class so that the collapsible sections are shownKleidukos2020-03-191-1/+1
| |
| * Prefer un-hyperlinked sources to no sourcesAlec Theriault2019-10-072-14/+26
| | | | | | | | | | | | It is possible to fail to extract an HIE ast. This is however not a reason to produce _no_ output - we should still make a colorized HTML page.
| * Fix crash when there are no srcspans in the file due to CPPZubin Duggal2019-10-071-8/+11
| |
| * update for new way to store hiefile headersZubin Duggal2019-06-041-2/+3
| |
| * Matching changes in GHC for #16236Alan Zimmerman2019-03-292-5/+5
| | | | | | | | (cherry picked from commit 3ee6526d4ae7bf4deb7cd1caf24b3d7355573576)
| * Remove workaround for now-fixed Clang CPP bug (#1028)Alec Theriault2019-03-292-48/+3
| | | | | | | | | | | | | | | | | | | | | | Before LLVM 6.0.1 (or 10.0 on Apple LLVM), there was a bug where lines that started with an octothorpe but turned out not to lex like pragmas would have an extra line added after them. Since this bug has been fixed upstream and that it doesn't have dire consequences anyways, the workaround is not really worth it anymore - we can just tell people to update their clang version (or re-structure their pragma code).
| * Many LaTeX backend fixesAlec Theriault2019-03-091-98/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After this commit, we can run with `--latex` on all boot libraries without crashing (although the generated LaTeX still fails to compile in a handful of larger packages like `ghc` and `base`). * Add newlines after all block elements in LaTeX. This is important to prevent the final output from being more an more indented. See the `latext-test/src/Example` test case for a sample of this. * Support associated types in class declarations (but not yet defaults) * Several small issues for producing compiling LaTeX; - avoid empy `\haddockbeginargs` lists (ex: `type family Any`) - properly escape identifiers depending on context (ex: `Int#`) - add `vbox` around `itemize`/`enumerate` (so they can be in tables) * Several spacing fixes: - limit the width of `Pretty`-arranged monospaced code - cut out extra space characters in export lists - only escape spaces if there are _multiple_ spaces - allow type signatures to be multiline (even without docs) * Remove uninteresting and repetitive `main.tex`/`haddock.sty` files from `latex-test` test reference output. Fixes #935, #929 (LaTeX docs for `text` build & compile) Fixes #727, #930 (I think both are really about type families...)
| * Avoid multi-line `emph` in LaTeX backendAlec Theriault2019-03-091-1/+1
| | | | | | | | | | | | | | | | `markupWarning` often processes inputs which span across paragraphs. Unfortunately, LaTeX's `emph` is not made to handle this (and will crash). Fixes #936.
| * Better support for default methods in classesAlec Theriault2019-03-093-51/+99
| | | | | | | | | | | | | | | | | | | | * default methods now get rendered differently * default associated types get rendered * fix a forgotten `s/TypeSig/ClassOpSig/` refactor in LaTeX backend * LaTeX backend now renders default method signatures NB: there is still no way to document default class members and the NB: LaTeX backend still crashes on associated types
| * Merge branch 'ghc-8.6' into ghc-8.8Alec Theriault2019-03-034-73/+64
| |\
| | * Keep forall on H98 existential data constructors (#1003)Alec Theriault2019-01-232-3/+3
| | | | | | | | | | | | | | | | | | | | | The information about whether or not there is a source-level `forall` is already available on a `ConDecl` (as `con_forall`), so we should use it instead of always assuming `False`! Fixes #1002.
| | * Print kinded tyvars in constructors for Hoogle (#993)Alec Theriault2019-01-071-2/+8
| | | | | | | | | Fixes #992
| | * More uniform handling of `forall`'s in HTML/LaTeXAlec Theriault2018-11-262-60/+50
| | | | | | | | | | | | | | | | | | | | | * don't forget to print explicit `forall`'s when there are arg docs * when printing an explicit `forall`, print all tyvars Fixes #973
| | * Rename 'NewOcean' theme to 'Linuwial'Alec Theriault2018-11-111-1/+1
| | |
| * | Better identifier parsingAlec Theriault2019-02-254-25/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * '(<|>)' and '`elem`' now get parsed and rendered properly as links * 'DbModule'/'DbUnitId' now properly get split apart into two links * tuple names now get parsed properly * some more small niceties... The identifier parsing code is more precise and more efficient (although to be fair: it is also longer and in its own module). On the rendering side, we need to pipe through information about backticks/parens/neither all the way through from renaming to the backends. In terms of impact: a total of 35 modules in the entirety of the bootlib + ghc lib docs change. The only "regression" is things like '\0'. These should be changed to @\\0@ (the path by which this previously worked seems accidental).
* | | Refactor for OutputableBndrId changesSebastian Graf2019-10-251-2/+2
| | |
* | | Remove spaces around @-patterns (#1093)Vladislav Zavialov2019-09-282-3/+3
| | | | | | | | | This is needed to compile `haddock` when [GHC Proposal #229](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0229-whitespace-bang-patterns.rst) is implemented.
* | | Changes for #15247Ryan Scott2019-07-033-50/+50
| | |
* | | update for new way to store hiefile headersZubin Duggal2019-05-301-2/+3
| | |
* | | Changes for #16110/#16356Ryan Scott2019-05-141-11/+2
| | |
* | | Visible dependent quantification (#16326) changesRyan Scott2019-02-274-25/+47
| | |
* | | Match GHC changes for T16185Alec Theriault2019-02-221-2/+2
| | | | | | | | | | | | | | | | | | | | | `FunTy` now has an `AnonArgFlag` that indicates whether the arrow is a `t1 => t2` or `t1 -> t2`. This commit shouldn't change any functionality in Haddock.
* | | Parser changes to match !380Vladislav Zavialov2019-02-171-6/+9
| | |
* | | Remove workaround for now-fixed Clang CPP bug (#1028)Alec Theriault2019-02-112-48/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before LLVM 6.0.1 (or 10.0 on Apple LLVM), there was a bug where lines that started with an octothorpe but turned out not to lex like pragmas would have an extra line added after them. Since this bug has been fixed upstream and that it doesn't have dire consequences anyways, the workaround is not really worth it anymore - we can just tell people to update their clang version (or re-structure their pragma code).
* | | Matching changes in GHC for #16236Alan Zimmerman2019-02-052-5/+5
|/ /
* | Miscellaneous improvements to `Convert` (#1020)Alec Theriault2019-02-032-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that Haddock is moving towards working entirely over `.hi` and `.hie` files, all declarations and types are going to be synthesized via the `Convert` module. In preparation for this change, here are a bunch of fixes to this module: * Add kind annotations to type variables in `forall`'s whose kind is not `Type`, unless the kind can be inferred from some later use of the variable. See `implicitForAll` and `noKindTyVars` in particular if you wish to dive into this. * Properly detect `HsQualTy` in `synifyType`. This is done by following suit with what GHC's `toIfaceTypeX` does and checking the first argument of `FunTy{} :: Type` to see if it classified as a given/wanted in the typechecker (see `isPredTy`). * Beef up the logic around figuring out when an explicit `forall` is needed. This includes: observing if any of the type variables will need kind signatures, if the inferred type variable order _without_ a forall will still match the one GHC claims, and some other small things. * Add some (not yet used) functionality for default levity polymorphic type signatures. This functionality similar to `fprint-explicit-runtime-reps`. Couple other smaller fixes only worth mentioning: * Show the family result signature only when it isn't `Type` * Fix rendering of implicit parameters in the LaTeX and Hoogle backends * Better handling of the return kind of polykinded H98 data declarations * Class decls produced by `tyThingToLHsDecl` now contain associated type defaults and default method signatures when appropriate * Filter out more `forall`'s in pattern synonyms
* | Use `.hie` files for the Hyperlinker backend (#977)Alec Theriault2019-01-316-556/+532
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # Summary This is a large architectural change to the Hyperlinker. * extract link (and now also type) information from `.hie` instead of doing ad-hoc SYB traversals of the `RenamedSource`. Also adds a superb type-on-hover feature (#715). * re-engineer the lexer to avoid needless string conversions. By going directly through GHC's `P` monad and taking bytestring slices, we avoid a ton of allocation and have better handling of position pragmas and CPP. In terms of performance, the Haddock side of things has gotten _much_ more efficient. Unfortunately, much of this is cancelled out by the increased GHC workload for generating `.hie` files. For the full set of boot libs (including `ghc`-the-library) * the sum of total time went down by 9-10% overall * the sum of total allocations went down by 6-7% # Motivation Haddock is moving towards working entirely over `.hi` and `.hie` files. This change means we no longer need the `RenamedSource` from `TypecheckedModule` (something which is _not_ in `.hi` files). # Details Along the way a bunch of things were fixed: * Cross package (and other) links are now more reliable (#496) * The lexer tries to recover from errors on every line (instead of at CPP boundaries) * `LINE`/`COLUMN` pragmas are taken into account * filter out zero length tokens before rendering * avoid recomputing the `ModuleName`-based `SrcMap` * remove the last use of `Documentation.Haddock.Utf8` (see #998) * restructure temporary folder logic for `.hi`/`.hie` model
* | Visible kind application haddock updatemynguyen2018-12-304-9/+38
| |
* | Properly synify and render promoted type variables (#985)Alec Theriault2018-12-231-3/+4
| | | | | | | | | | | | | | | | * Synify and render properly promoted type variables Fixes #923. * Accept output
* | Refactor names + unused functions (#982)Alec Theriault2018-12-173-15/+9
| | | | | | | | | | | | | | This commit should not introduce any change in functionality! * consistently use `getOccString` to convert `Name`s to strings * compare names directly when possible (instead of comparing strings) * get rid of unused utility functions
* | Fix warnings, accept outputAlec Theriault2018-12-121-1/+0
| | | | | | | | | | | | | | * remove redundant imports (only brought to light due to recent work for improving redundant import detection) * fix a bug that was casuing exports to appear in reverse order * fix something in haddock-library that prevented compilation on old GHC's
* | [TTG: Handling Source Locations] Foundation and PatShayan-Najd2018-11-234-33/+54
| | | | | | | | | | | | | | | | | | | | | | Trac Issues #15495 This patch removes the ping-pong style from HsPat (only, for now), using the plan laid out at https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow/HandlingSourceLocations (solution A). - the class `HasSrcSpan`, and its functions (e.g., `cL` and `dL`), are introduced - some instances of `HasSrcSpan` are introduced - some constructors `L` are replaced with `cL` - some patterns `L` are replaced with `dL->L` view pattern - some type annotation are necessarily updated (e.g., `Pat p` --> `Pat (GhcPass p)`)
* | Follow GHC HEAD's HsTypes.Promoted -> BasicTypes.PromotionFlag changeAlp Mestanogullari2018-11-153-4/+7
| | | | | | | | It got introduced in ghc/ghc@ae2c9b40f5b6bf272251d1f4107c60003f541b62.
* | Merge branch 'ghc-8.6' into ghc-headAlec Theriault2018-11-106-42/+64
|\|
| * Merge branch 'ghc-8.6' into wip/new-oceanAlec Theriault2018-11-093-17/+24
| |\
| | * Only run MathJax on entities with "mathjax" class (#960)Alec Theriault2018-11-052-11/+17
| | | | | | | | | | | | | | | | | | | | | Correspondingly, we wrap all inline/diplay math in <span class="mathjax"> ... the math .... </span> This fixes #959.
| | * Fix documentation in `haddock-api` (#957)Alec Theriault2018-10-271-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix misplaced Haddocks in Haddock itself Haddock should be able to generate documentation for 'haddock-api' again. * Make CI check that documentation can be built. * Add back a doc that is OK
| * | Clicking on "Contents" navigates to top of pageAlec Theriault2018-11-081-1/+1
| | |
| * | Allow "Contents" summary to scroll in a fixed divAlec Theriault2018-11-072-4/+5
| | | | | | | | | | | | | | | In the unfortunate event that the "Contents" summary doesn't fit vertically (like in the "Prelude"), it will be scrollable.
| * | Fix issues around plus/minusAlec Theriault2018-11-072-3/+5
| | | | | | | | | | | | | | | | | | * swap the minimize unicode to something more intuitive * use new unicode expander/collapser for instance lists * address some alignment issues in the "index" page