aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Interface
Commit message (Collapse)AuthorAgeFilesLines
...
* Matching changes in GHC for #16236Alan Zimmerman2019-02-052-5/+5
|
* Miscellaneous improvements to `Convert` (#1020)Alec Theriault2019-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-311-37/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # 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-303-13/+32
|
* Refactor names + unused functions (#982)Alec Theriault2018-12-172-19/+8
| | | | | | | 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
* Output better debug infromation on internal error in extractDeclZejun Wu2018-12-141-1/+3
| | | | This will make investigation of #979 easier
* Fix warnings, accept outputAlec Theriault2018-12-121-2/+1
| | | | | | | * 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-231-0/+1
| | | | | | | | | | | 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-151-1/+1
| | | | It got introduced in ghc/ghc@ae2c9b40f5b6bf272251d1f4107c60003f541b62.
* Merge branch 'ghc-8.6' into ghc-headAlec Theriault2018-11-102-3/+2
|\
| * Avoid some partialityAlec Theriault2018-10-261-1/+1
| | | | | | | | | | | | | | | | AFAICT this wasn't causing any crashes, but that's mostly because we happen not to be forcing `pkgStr` when it would diverge. We come dangerously close to doing that in `ppHtmlIndex`. Fixes #569.
| * Fix typo in a warningSimon Jakobi2018-10-231-2/+1
| |
| * Accumulate explicitly which modules to load for 'attachInstances'Alec Theriault2018-08-211-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The old approach to fixing #469, while correct, consumes a lot of memory. We ended up with a HUGE 'GblRdrEnv' in 'ic_rn_gbl_env'. However, 'getNameToInstancesIndex' takes that environment and compresses it down to a much smaller 'ModuleSet'. Now, we compute that 'ModuleSet' explicitly as we process modules. That way we can just tell 'getNameToInstancesIndex' what modules to load (instead of it trying to compute that information from the interactive context). (cherry picked from commit 5c7c596c51d69b92164e9ba920157b36ce2b2ec1)
| * outOfScope: Recommend qualifying the identifierSimon Jakobi2018-07-201-1/+3
| |
| * Don't warn about ambiguous identifiers when the candidate names belong to ↵Simon Jakobi2018-07-201-18/+35
| | | | | | | | | | | | | | | | | | | | the same type This also changes the defaulting heuristic for ambiguous identifiers. We now prefer local names primarily, and type constructors or class names secondarily. Partially fixes #854.
| * Update the ghc-8.6 branch (#889)Simon Jakobi2018-07-201-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Revert "Bump GHC version to 8.6" This was applied to the wrong branch; there's now a `ghc-8.6` branch; ghc-head is always supposed to point to GHC HEAD, i.e. an odd major version. The next version bump to `ghc-head` is supposed to go from e.g. 8.5 to 8.7 This reverts commit 5e3cf5d8868323079ff5494a8225b0467404a5d1. * README updates (#856) * README: Remove mentions of master branch * README: Add instructions for using html-test * README: Change command to run _all_ the testsuites * README: Add project overview section (cherry picked from commit 61d6f935da97eb96685f07bf385102c2dbc2a33c) * Export more fixities for Hoogle (#871) This exports fixities for more things, including class methods and type-level operators. (cherry picked from commit 88316b972e3d47197b1019111bae0f7f87275fce) * Avoid line breaks due to line length in Hoogle (#868) * Avoid line breaks due to line length in Hoogle Hoogle operates in a line-oriented fashion, so we should avoid ever breaking due to long lines. One way of doing this non-intrusively is to modify the 'DynFlags' that are threaded through the 'Hoogle' module (note this is anyways only passed through for use in the various 'showSDoc' functions). * Amend test case (cherry picked from commit 657b1b3d519545f8d4ca048c06210d6cbf0f0da0) * tyThingToLHsDecl: Preserve type synonyms that contain a forall (#880) * tyThingToLHsDecls: Preserve type synonyms that contain a forall Fixes #879. * Add Note [Invariant: Never expand type synonyms] * Clarify Note [Invariant: Never expand type synonyms] (cherry picked from commit c3eb3f0581f69e816f9453b1747a9f2a3ba02bb9) * Fix HEAD html-test (#860) * Update tests for 'StarIsType' * Accept tests * Revert "Update tests for 'StarIsType'" This reverts commit 7f0c01383bbba6dc5af554ee82988d2cf44e407a. * Refactor handling of parens in types (#874) * Fix type parenthesization in Hoogle backend Ported the logic in the HTML and LaTeX backends for adding in parens into something top-level in 'GhcUtil'. Calling that from the Hoogle backend fixes #873. * Remove parenthesizing logic from LaTeX and XHTML backends Now, the only times that parenthesis in types are added in any backend is through the explicit 'HsParTy' constructor. Precedence is also represented as its own datatype. * List out cases explicitly vs. catch-all * Fix printing of parens for QuantifiedConstraints The priority of printing 'forall' types was just one too high. Fixes #877. * Accept HTML output for quantified contexts test * Preserve docs on type family instances (#867) * Preserve docs on type family instances The only problem was that the instance location was slightly off for type family instances. * Accept output (cherry picked from commit 133e9c2c168db19c1135479f7ab144c4e33af2a4) * Fix broken instance source links (#869) The problem manifests itself in instances that are defined in modules other than the module where the class is defined. The fix is just to thread through the 'Module' of the instance further along. Since orphan instances appear to already have been working, I didn't do anything there. (cherry picked from commit 2de7c2acf9b1ec85b09027a8bb58bf8512e91c05) * Add some more unicode related tests (#872) This has been fixed for sure ever since we switched from attoparsec to parsec. Parts of it may have been working before that, but there was a point where this would have failed (see #191). A regression test never hurt anyone. :) (cherry picked from commit 5ec7715d418bfac0f26aec6039792a99a6e89370) * Misc tests (#858) * More tests * spliced types * constructor/pattern argument docs * strictness marks on fields with argument docs * latex test cases need seperate directory * Accept tests * Additional tests for the identifier parser (#816) * Add tests for the identifier parser * docs: Clarify how to delimit identifiers (cherry picked from commit 0861affeca4d72938f05a2eceddfae2c19199071)
* | Support hyperlink labels with inline markupAlec Theriault2018-11-061-1/+1
| | | | | | | | The parser for pictures hasn't been properly adjusted yet.
* | Improve perf of renamingAlec Theriault2018-11-051-36/+33
| | | | | | | | | | | | | | | | Perf only change: * don't look up type variable names (they're never in the environment) * use a difference list for accumulating missing names * more efficient 'Functor'/'Applicative' instances for 'RnM'
* | Specialize some SYB functionsAlec Theriault2018-11-051-4/+4
| | | | | | | | | | | | | | Perf only change: * Add a 'SPECIALIZE' pragma to help GHC optimize a 'Data a =>' constraint * Manually specialize the needlessly general type of 'specializeTyVarBndrs'
* | Deduplicate some work in 'AttachInstances'Alec Theriault2018-11-051-27/+40
| | | | | | | | | | | | | | | | | | Perf only change: * avoid needlessly union-ing maps * avoid synify-ing instances twice Took this opportunity to add some docs too
* | More explicit foralls (GHC Proposal 0007)Matthew Yacavone2018-10-271-4/+11
| |
* | Merge pull request #893 from harpocrates/get-name-to-instancesBen Gamari2018-08-211-4/+7
|\ \ | | | | | | Accumulate explicitly which modules to load for 'attachInstances'
| * | Accumulate explicitly which modules to load for 'attachInstances'Alec Theriault2018-07-231-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old approach to fixing #469, while correct, consumes a lot of memory. We ended up with a HUGE 'GblRdrEnv' in 'ic_rn_gbl_env'. However, 'getNameToInstancesIndex' takes that environment and compresses it down to a much smaller 'ModuleSet'. Now, we compute that 'ModuleSet' explicitly as we process modules. That way we can just tell 'getNameToInstancesIndex' what modules to load (instead of it trying to compute that information from the interactive context).
* | | eqTyCon_RDR now lives in TysWiredInRyan Scott2018-07-271-1/+1
|/ / | | | | | | | | After GHC commit http://git.haskell.org/ghc.git/commit/f265008fb6f70830e7e92ce563f6d83833cef071
* | Don't warn about ambiguous identifiers when the candidate names belong to ↵Simon Jakobi2018-07-201-18/+35
| | | | | | | | | | | | | | | | | | | | | | | | the same type This also changes the defaulting heuristic for ambiguous identifiers. We now prefer local names primarily, and type constructors or class names secondarily. Partially fixes #854. (cherry picked from commit d504a2864a4e1982e142cf88c023e7caeea3b76f)
* | outOfScope: Recommend qualifying the identifierSimon Jakobi2018-07-201-1/+3
| | | | | | | | (cherry picked from commit 73707ed58d879cc04cb644c5dab88c39ca1465b7)
* | Preserve docs on type family instances (#867)Alec Theriault2018-07-201-2/+5
|/ | | | | | | | | | | * Preserve docs on type family instances The only problem was that the instance location was slightly off for type family instances. * Accept output (cherry picked from commit 133e9c2c168db19c1135479f7ab144c4e33af2a4)
* Remove HsEqTy and XEqTyRyan Scott2018-06-192-2/+0
|
* Handle -XStarIsTypeVladislav Zavialov2018-06-142-2/+3
|
* Fix redundant import warningsSimon Jakobi2018-06-132-2/+1
|
* Renamer: Warn about ambiguous identifiers (#831)Simon Jakobi2018-06-131-3/+17
| | | | | | | | | | | | | | | | | | | * Renamer: Warn about ambiguous identifiers Example: Warning: 'elem' is ambiguous. It is defined * in ‘Data.Foldable’ * at /home/simon/tmp/hdk/src/Lib.hs:7:1 You may be able to disambiguate the identifier by qualifying it or by hiding some imports. Defaulting to 'elem' defined at /home/simon/tmp/hdk/src/Lib.hs:7:1 Fixes #830. * Deduplicate warnings Fixes #832.
* Renamer: Warn about out of scope identifiers. (#819)Simon Jakobi2018-06-131-6/+11
|
* Extract docs from strict/unpacked constructor args (#839)Alec Theriault2018-06-131-0/+1
| | | This fixes #836.
* DerivingVia changesRyan Scott2018-06-131-2/+9
|
* Remove ParallelArrays and Data Parallel HaskellBen Gamari2018-06-132-2/+0
|
* Adjust to new HsDocString internalsSimon Jakobi2018-06-132-13/+12
|
* Merge branch 'ghc-head' with 'ghc-8.4'Herbert Valerio Riedel2018-05-014-301/+335
|\
| * Match changes in GHC for TTGAlan Zimmerman2018-04-274-129/+152
| |
| * Match GHC for TTG implemented on HsBinds, D4581Alan Zimmerman2018-04-133-20/+20
| |
| * Match GHC changes for TTGAlan Zimmerman2018-04-093-139/+129
| |
| * Updates for #13324Ryan Scott2018-03-061-1/+1
| |
| * Merge remote-tracking branch 'harpocrates/fix/missing-orphan-instances' into ↵Ben Gamari2018-01-261-1/+1
| |\ | | | | | | | | | ghc-head
| | * Pass to GHC visible modules for instance filteringAlec Theriault2018-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The GHC-side `getNameToInstancesIndex` filters out incorrectly some instances because it is not aware of what modules are visible. On the Haddock side, we need to pass in the modules we are processing. On the GHC side, we need to check against _those_ modules when checking if an instance is visible.
| * | Fix duplicate declarations and TypeFamilies specificsalexbiehl2018-01-201-17/+29
| | |
| * | extractDecl: Extract associated types correctly (#736)Alexander Biehl2018-01-191-11/+21
| | |
| * | Constructor and pattern synonym argument docs (#709)Alec Theriault2018-01-131-14/+29
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Support Haddocks on constructor arguments This is in conjunction with https://phabricator.haskell.org/D4094. Adds support for rendering Haddock's on (non-record) constructor arguments, both for regular and GADT constructors. * Support haddocks on pattern synonym arguments It appears that GHC already parsed these - we just weren't using them. In the process of doing this, I tried to deduplicate some code around handling patterns. * Update the markup guide Add some information about the new support for commenting constructor arguments, and mention pattern synonyms and GADT-style constructors. * Overhaul LaTeX support for data/pattern decls This includes at least * fixing several bugs that resulted in invalid LaTeX * fixing GADT data declaration headers * overhaul handling of record fields * overhaul handling of GADT constructors * overhaul handling of bundled patterns * add support for constructor argument docs * Support GADT record constructors This means changes what existing HTML docs look like. As for LaTeX, looks like GADT records were never even supported. Now they are. * Clean up code/comments Made code/comments consistent between the LaTeX and XHTML backend when possible. * Update changelog * Patch post-rebase regressions * Another post-rebase change We want return values to be documentable on record GADT constructors.
| * Track changes to follow Trac #14529Simon Peyton Jones2017-12-072-28/+34
| | | | | | | | This tracks the refactoring of HsDecl.ConDecl.
* | @since includes package name (#749)Alec Theriault2018-03-273-30/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Metadoc stores a package name This means that '@since' annotations can be package aware. * Get the package name the right way This should extract the package name for `@since` annotations the right way. I had to move `modulePackageInfo` around to do this and, in the process, I took the liberty to update it. Since it appears that finding the package name is something that can fail, I added a warning for this case. * Silence warnings * Hide package for local 'since' annotations As discussed, this is still the usual case (and we should avoid being noisy for it). Although this commit is large, it is basically only about threading a 'Maybe Package' from 'Haddock.render' all the way to 'Haddock.Backends.Xhtml.DocMarkup.renderMeta'. * Bump binary interface version * Add a '--since-qual' option This controls when to qualify since annotations with the package they come from. The default is always, but I've left an 'external' variant where only those annotations coming from outside of the current package are qualified. * Make ParserSpec work * Make Fixtures work * Use package name even if package version is not available The @since stuff needs only the package name passed in, so it makes sense to not be forced to pass in a version too.
* | Show where instances are defined (#748)Alec Theriault2018-03-212-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Indicate source module of instances Above instance, we now also display a link to the module where the instance was defined. This is sometimes helpful in figuring out what to import. * Source module for type/data families too * Remove parens * Accept tests
* | extractDecl: Extract constructor patterns from data family instances (#776)Alexander Biehl2018-03-131-13/+26
| | | | | | | | | | | | * extractDecl: Allow extraction of data family instance constructors * extractDecl: extract data family instance constructors