aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Fallback to `hiDecl` when `extractDecl` failsAlec Theriault2020-04-211-45/+69
| | | | | | | | | | | | Sometimes, the declaration being exported is a subdecl (for instance, a record accessor getting exported at the top-level). For these cases, Haddock has to find a way to produce some synthetic sensible top-level declaration. This is done with `extractDecl`. As is shown by #1067, this is sometimes impossible to do just at a syntactic level (for instance when the subdecl is re-exported). In these cases, the only sensible thing to do is to try to reify a declaration based on a GHC `TyThing` via `hiDecl`.
* Don't warn about missing links in miminal sigsAlec Theriault2020-04-152-4/+17
| | | | | | | | | | | When renaming the Haddock interface, never emit warnings when renaming a minimal signature. Also added some documention around `renameInterface`. Minimal signatures intentionally include references to potentially un-exported methods (see the discussion in #330), so it is expected that they will not always have a link destination. On the principle that warnings should always be resolvable, this shouldn't produce a warning. See #1070.
* Prune docstrings that are never renderedAlec Theriault2020-04-151-2/+15
| | | | | | | | | | | | | | | | | | | When first creating a Haddock interface, trim `ifaceDocMap` and `ifaceArgMap` to not include docstrings that can never appear in the final output. Besides checking with GHC which names are exported, we also need to keep all the docs attached to instance declarations (it is much tougher to detect when an instance is fully private). This change means: * slightly smaller interface files (7% reduction on boot libs) * slightly less work to do processing docstrings that aren't used * no warnings in Haddock's output about private docstrings (see #1070) I've tested manually that this does not affect any of the boot library generated docs (the only change in output was some small re-ordering in a handful of instance lists). This should mean no docstrings have been incorrectly dropped.
* Recode Doc to Json. (#1159)Ignat Insarov2020-04-091-5/+162
| | | | | * Recode Doc to Json. * More descriptive field labels.
* Fix #1050 by filtering out invisible AppTy argumentsRyan Scott2020-04-051-5/+8
| | | | | | | | | | | | This makes the `synifyType` case for `AppTy` more intelligent by taking into consideration the visibilities of each `AppTy` argument and filtering out any invisible arguments, as they aren't intended to be displayed in the source code. (See #1050 for an example of what can happen if you fail to filter these out.) Along the way, I noticed that a special `synifyType` case for `AppTy t1 (CoercionTy {})` could be consolidated with the case below it, so I took the opportunity to tidy this up.
* 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
* Cleanup up GHC flags in `.cabal` filesAlec Theriault2020-03-282-2/+2
| | | | | | | | * enable more useful warning flags in `haddock-api`, handle the new warnings generated * remove `-fwarn-tabs` (now we'd use `-Wtabs`, but this has been in `-Wall` for a while now)
* Use `unLoc`/`noLoc` from GHC instead of `unL`/`reL`Alec Theriault2020-03-285-57/+44
| | | | | | | | * `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-286-26/+21
| | | | | | | | | | | 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-286-147/+102
| | | | | | | * 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`
* Disallow qualified uses of reserved identifiersAlec Theriault2020-03-271-12/+22
| | | | | | | | | This a GHC bug (https://gitlab.haskell.org/ghc/ghc/issues/14109) too, but it is a relatively easy fix in Haddock. Note that the fix must live in `haddock-api` instead of `haddock-library` because we can only really decide if an identifier is a reserved one by asking the GHC lexer. Fixes #952
* Tentative 2.24 releaseAlec Theriault2020-03-222-2/+2
| | | | | Adjusted changelogs and versions in `.cabal` files in preparation for the upcoming release bundled with GHC 8.10.
* Clean up warningsAlec Theriault2020-03-2212-21/+9
| | | | | | * 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-2024-451/+701
|\
| * Replace the 'caption' class so that the collapsible sections are shownKleidukos2020-03-191-1/+1
| |
| * Changes from #14579Ryan Scott2019-11-031-22/+5
| | | | | | | | | | | | | | We now have a top-level `tyConAppNeedsKindSig` function, which means that we can delete lots of code in `Convert`. (cherry picked from commit cfd682c5fd03b099a3d78c44f9279faf56a0ac70)
| * Reify oversaturated data family instances correctly (#1103)Ryan Scott2019-10-231-15/+23
| | | | | | | | | | | | This fixes #1103 by adapting the corresponding patch for GHC (see https://gitlab.haskell.org/ghc/ghc/issues/17296 and https://gitlab.haskell.org/ghc/ghc/merge_requests/1877).
| * 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-072-9/+12
| |
| * Fix the ignore-exports option (#1082)Alexis King2019-09-301-4/+5
| | | | | | The `ignore-exports` option has been broken since #688, as mentioned in https://github.com/haskell/haddock/pull/766#issue-172505043. This PR fixes it.
| * update for new way to store hiefile headersZubin Duggal2019-06-041-2/+3
| |
| * Remove Haddock's dependency on `Cabal`Alec Theriault2019-05-263-8/+21
| | | | | | | | | | | | | | | | At this point, Haddock depended on Cabal-the-library solely for a verbosity parser (which misleadingly accepts all sorts of verbosity options that Haddock never uses). Now, the only dependency on Cabal is for `haddock-test` (which uses Cabal to locate the Haddock interface files of a couple boot libraries).
| * Fix #1063 with better parenthesization logic for contextsAlec Theriault2019-05-171-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only other change in html/hoogle/hyperlinker output for the boot libraries that this caused is a fix to some Hoogle output for implicit params. ``` $ diff -r _build/docs/ old_docs diff -r _build/docs/html/libraries/base/base.txt old_docs/html/libraries/base/base.txt 13296c13296 < assertError :: (?callStack :: CallStack) => Bool -> a -> a --- > assertError :: ?callStack :: CallStack => Bool -> a -> a ```
| * Comment C, which clarifies why e.g. ReadP is not enoughOleg Grenrus2019-05-131-0/+7
| |
| * Redo ParseModuleHeaderOleg Grenrus2019-05-131-93/+125
| |
| * Matching changes in GHC for #16236Alan Zimmerman2019-03-294-10/+10
| | | | | | | | (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-094-51/+102
| | | | | | | | | | | | | | | | | | | | * 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-038-83/+81
| |\
| | * `--show-interface` should output to stdout. (#1040)Alec Theriault2019-02-281-1/+2
| | | | | | | | | Fixes #864.
| | * Fix standalone deriving docsAlec Theriault2019-02-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Docs on standalone deriving decls for classes with associated types should be associated with the class instance, not the associated type instance. Fixes #1033
| | * Fix #1004 with a pinch of dropForAllsRyan Scott2019-01-271-1/+1
| | |
| | * 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
| | * Load plugins when compiling each module (#983)Alec Theriault2018-12-202-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * WIP: Load (typechecker) plugins from language pragmas * Revert "Load plugins when starting a GHC session (#905)" This reverts commit 72d82e52f2a6225686d9668790ac33c1d1743193. * Simplify plugin initialization code
| | * 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
| | |
| * | Fix bogus identifier defaultingAlec Theriault2019-02-261-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | This avoids a situation in which an identifier would get defaulted to a completely different identifier. Prior to this commit, the 'Bug1035' test case would hyperlink 'Foo' into 'Bar'! Fixes #1035.
| * | Better identifier parsingAlec Theriault2019-02-2511-66/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * '(<|>)' 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).
| * | Support value/type namespaces on identifier linksAlec Theriault2019-02-255-22/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Identifier links can be prefixed with a 'v' or 't' to indicate the value or type namespace of the desired identifier. For example: -- | Some link to a value: v'Data.Functor.Identity' -- -- Some link to a type: t'Data.Functor.Identity' The default is still the type (with a warning about the ambiguity)
* | | Define `XRec` for location information and get rid of `HasSrcSpan`Sebastian Graf2019-11-011-16/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | In https://gitlab.haskell.org/ghc/ghc/merge_requests/1970 I propose a simpler way to encode location information into the GHC and Haddock AST while incurring no cost for e.g. TH which doesn't need location information. These are just changes that have to happen in lock step.
* | | Refactor for OutputableBndrId changesSebastian Graf2019-10-252-4/+4
| | |
* | | Refactor for withTiming changes.Andreas Klebinger2019-10-212-9/+9
| | |
* | | 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.
* | | Small change in to facilitate extended typed-holes (#1090)Matthías Páll Gissurarson2019-09-281-4/+4
| | | | | | | | | This change has no functional effect on haddock itself, it just changes one pattern to use `_ (` rather than `_(`, so that we may use `_(` as a token for extended typed-holes later.
* | | Fix for GHC module renamingSylvain Henry2019-09-121-1/+1
| | |
* | | Changes for #15247Ryan Scott2019-07-0310-321/+347
| | |