packages feed

haddock 2.17.5 → 2.18.1

raw patch · 201 files changed

+6329/−4017 lines, 201 filesdep ~basedep ~ghcdep ~haddock-api

Dependency ranges changed: base, ghc, haddock-api

Files

− CHANGES
@@ -1,762 +0,0 @@-Changes in version 2.17.4-- * Fix 'internal error: links: UnhelpfulSpan' (#554, #565)-- * Hyperlink backend knows about `DataKinds` (#510)-- * Fix rendering of class methods for `Eq` and `Ord` (#549)-- * Export `MDoc` and `toInstalledIface` from `Haddock.Types`--Changes in version 2.17.3.1-- * Disable `NFData` instances for GHC types when GHC >= 8.0.2 (#537)--Changes in version 2.17.3-- * Remove framed view of the HTML documentation--Changes in version 2.17.2-- * Fix portability of documentation building within GHC--Changes in version 2.17.1-- * Included with GHC 8.0.1-- * Fixed Makefile for GHC installation-- * Fixed clean rule of GHC Makefile--Changes in version 2.17.0 (not released)-- * Support typesetting of mathematical expressions via Mathjax (#397)-- * Describe orphan instances defined in a module in its documentation (#449)-- * Produce specialized type signatures for typeclass methods (#425)-- * Support GCC-like response files (#470)--Changes in version 2.16.2-- * Generate hyperlinked source ourselves (#410, part of GSOC 2015)-- * Fix expansion icon for user-collapsible sections (#412)-- * Break up response file arguments on newlines-- * Various HTML fixes (#301, #406, #407, #421)-- * Line anchors in hyperlinked source (#420)--Changes in version 2.16.1-- * Don't default to type constructors for out-of-scope names (#253 and-   #375)-- * Fix Hoogle display of constructors (#361)-- * Fully qualify names in Hoogle instances output (#263)-- * Output method documentation in Hoogle backend (#259)-- * Don't print instance safety information in Hoogle (#168)-- * Expand response files in arguments (#285)-- * Build the main executable with -threaded (#399)-- * Use SrcSpan of declarations for inferred type sigs (#207)-- * Fix cross-module instance locations (#383)-- * Fix alignment of Source link for instances in Firefox (#384)--Changes in version 2.16.0-- * Experimental collapsible header support (#335)-- * Add support for markdown links and images-- * Allow an optional colon after the closing bracket of definition lists.-   This is to disambiguate them from markdown links and will be require with a-   future release.-- * Fix re-exports of built-in type families (#310)-- * Fix parsing of infix identifiers such as ``elem``.-- * Print missing docs by default and add --no-print-missing-docs-- * parser: now parses out some meta data too, breaking the API-- * parser: markdown syntax for images and URLs is now accepted:-   <<foo>> style for images and <foo bar> style for links is now-   considered deprecated. <foo> for links is still OK.-- * parser: add support for @since element: this is paragraph-level-   element of the form ‘@since x.y.z’ where x.y.z is the version-   number. The way it is rendered is subject to change.-- * properly render package ID (not package key) in index (#329)-- * links to source location of class instance definitions-- * Fix code blocks in presence of Windows line endings-- * Deal better with long synopsis lines (#151)--Changes in version 2.15.0-- * Always read in prologue files as UTF8 (#286 and Cabal #1721)-- * parser: don't wrap headers in DocParagraph (#307)-- * parser: don't mangle append order for nested lists (pandoc #1346)-- * parser: preserve list ordering in certain scenarios (#313)-- * parser: update the attoparsec version used internally giving slight-   parsing performance boost.-- * Move development to be against latest GHC release and not GHC HEAD.-- * Further split up the package to separate the executable from the-   library, necessary by things like GHCJS. We now have-   ‘haddock-library’ which are the parts that don't use GHC API,-   ‘haddock-api’ which are (some of) the parts that do use GHC API and-   ‘haddock’ which merely provides the executable.-- * Export few extra functions in the API.-- * Add compatibility with GHC 7.8.2.-- * Omit unnecessary ‘forall’s (#315 and #86)-- * Remove some files which were really old or did not belong in the-   repository in the first place.--Changes in version 2.14.3-- * Fix parsing of identifiers with ^ or ⋆ in them (#298)-- * Fix anchors (#308)--Changes in version 2.14.2-- * Always drop --split-objs GHC flag for performance reasons (#292)-- * Print kind signatures GADTs (#85)-- * Drop single leading whitespace when reasonable from @-style blocks (#201)-- * Fix crashes associated with exporting data family record selectors (#294)--Changes in version 2.14.1-- * Render * and -> with their UnicodeSyntax equivalents if -U is enabled-- * Display minimal complete definitions for type classes-- * Hide right hand side of TF instances with hidden names on the RHS--Changes in version 2.14.0-- * Print entities with missing documentation (#258)-- * Print a warning message when given `-optghc` instead of `--optghc` (#5)-- * Add `--compatible-interface-versions` (#231)-- * Allow to generate latex documentation for FFI declarations (#247)-- * Add copyright and license information to generated documentation-- * Improved to Unicode support-- * Bold markup support-- * Nested paragraphs-- * Better escaping-- * Header markup-- * Parser should no longer fail to parse any markup-- * {-# OPTIONS_HADDOCK show-extensions #-} pragma will show the GHC extensions-   enabled in the module.-- * Properly render License field (#271)-- * Print type/data family instances (for exported types only)-- * Fix display of poly-kinded type operators (#189)-- * PatternSynonyms support-- * Fix display of implicit parameters (#260)-- * Fix rendering of Contents when links are present (#276)-- * Fix documentation duplication on record fields (#195)-- * Add `--source-entity-line` for exact line links (eg. things defined-   inside TH splices) (#79)-- * Display fixity information for names with nonstandard fixities-- * Bird tracks specified like "> code" no longer suffer from an extra leading-   space in the code output--Changes in version 2.13.2-- * Handle HsExplicitListTy in renamer (#213)-- * Allow haddock markup in deprecation messages-- * Export more types from Documentation.Haddock-- * Include everything that is required to run the test suite with the cabal-   package (#230)--Changes in version 2.13.1-- * Hide instances that are "internal" to a module-- * Add support for properties in documentation-- * Fix a bug with spurious superclass constraints-- * Fix and extend the Haddock API--Changes in version 2.12.0-- * Labeled URLs (e.g <http://example.net/ some label>)-- * Improved memory usage (new dependency: deepseq)--Changes in version 2.11.0-- * Show deprecation messages for identifiers-- * List identifiers declared on the same line (with a common type) separately-- * Don't crash on unicode strings in doc comments-- * Fix reporting of modules safe haskell mode-- * Fix a case where we were generating invalid xhtml-- * Improved --qual option (no crashes, proper error messages)-- * A new --qual option "aliased" which qualifies identifiers by the module alias-   used in the source code-- * The Haddock API restores GHC's static flags after invocation-- * Access to unexported identifiers through the Haddock API again--Changes in version 2.10.0-- * Require GHC >= 7.4-- * Safe Haskell indications on module pages-- * Type declarations on identifiers no longer necessary-- * Add flag --interface-version-- * Warn when comment refers to in-scope identifier without documentation-- * Bug fix: links to out-of-scope things (#78)-- * Bug fix: module references to other packages work again--Changes in version 2.9.4--  * Require GHC >= 7.2--  * Support Alex 3.x--Changes in version 2.9.3--  [This is the version that comes with GHC 7.2.1 although it claims it's 2.9.2!]--  * Build with GHC 7.2.1--  * Support blank lines in results of examples--  * A type signature for multiple names generates one signature in the output--  * Minor bug fixes--Changes in version 2.9.2--  * Build with GHC 7.0.2--  * Write Hoogle output in utf8; fixes GHC build on Windows--Changes in version 2.9.1--  * Fix build in GHC tree--  * Improve .cabal file--Changes in version 2.9.0--  * Drop support for ghc < 7--  * New flag --qual for qualification of names--  * Print doc coverage information to stdout when generating docs--  * Include an 'All' option in the A-Z subdivided index--  * Make TOC group header identifiers validate--  * Minor changes to the API--Changes in the version that comes with GHC 7.0.1--  [This version claims it is 2.8.0 but is actually based on 2.8.1]--  * Fix URL creation on Windows: Use / not \ in URLs.--  * Support GHC 7.0--Changes in version 2.8.1--  * Fix build on Windows with MinGW--Changes in version 2.8.0--  * HTML backend completely rewritten to generate semantically rich XHTML-    using the xhtml package.--  * New default CSS based on the color scheme chosen for the new Haskell-    wiki, with a pull-out tab for the synopsis.--  * Theme engine based on CSS files. Themes can be switched from the-    header menu. (New flags --built-in-themes and --theme. The latter-    is an alias for --css which now has extended semantics).--  * Markup support for executable examples/unit-tests. To be used with an-    upcoming version of the DocTest program.--  * Addition of a LaTeX backend.--  * Frames-mode can be enabled from the header menu.--  * Path to source entities can be specified per package, so that source-    links work for cross-package documentation.--  * Support for a second form of enumerated lists (1. 2. etc).--  * Additions and changes to the Haddock API.--  * New flag --no-tmp-comp-dir to tell Haddock to write and pick up-    compilation files (.o, .hi, etc) to/from GHC's output directory instead-    of a temporary directory.--  * Various bug fixes.---------------------------------------------------------------------------------Changes in version 2.6.1 (bug fix release from the stable branch)--  * Fix #128---------------------------------------------------------------------------------Changes in version 2.7.2--  * Add Paths_haddock to library---------------------------------------------------------------------------------Changes in version 2.7.1:--  * Fix problems with library part of .cabal file---------------------------------------------------------------------------------Changes in version 2.7.0:--  * Instances can be commented--  * The Haddock API now exposes more of the internals of Haddock--  * Bug fixes (most importantly #128)---------------------------------------------------------------------------------Changes in version 2.6.0:--  * Drop support for GHC 6.10.*--  * Add support for GHC 6.12.1--  * Cross-package documentation: full documentation show up when re-exporting-    things coming from external packages--  * Lexing and parsing the Haddock comment markup is now done in Haddock-    again, instead of in GHC--  * Slightly prettier printing of instance heads--  * Support platforms for which GHC has no native code generator--  * Add a flag --print-ghc-libdir--  * Minor bug fixes---------------------------------------------------------------------------------Changed in version 2.5.0:--  * Drop support for GHC 6.8.*--  * Add support for GHC 6.10.3 and 6.10.4--  * Revert to the old multi-page index for large packages (#106)--  * Show GADT records in the generated documentation--  * Create output directory if it doesn't exist (#104)--  * Use the native codegen instead of compiling via C for TH modules--  * Add --use-unicode flag for displaying prettier versions of common symbols--  * Multiple verbosity levels: remove --verbose and add --verbosity=n---------------------------------------------------------------------------------Changed in version 2.4.2:--  * Support GHC 6.10.2--  * Haddock no longer crashes on Template Haskell modules (#68)-    (only with GHC 6.10.2 or above)--  * Fix problem with Template Haskell-generated declarations disappearing (#59)--  * Generate two anchors for each link for compatibility between IE and Opera-    (#45)--  * Improved error messages--  * Show re-exports from external packages again (GHC ticket #2746)--  * Store hidden modules in .haddock files again (needed by the haddock-    library)--  * Avoid processing boot modules--  * Pragmas may exist between document comments and declarations--  * Do not indicate that a constructor argument is unboxed--  * Fix problem with non-working links to ghc-prim--  * Allow referring to a specific section within a module in a module link-    (#65)--  * Fixes to the Hoogle backend--  * Improvements to the haddock library--  * Many other fixes (including #67, #69, #58, #57)---------------------------------------------------------------------------------Changed in version 2.4.1:--  * Depend on base 4.* when GHC >= 6.9, otherwise 3.*---------------------------------------------------------------------------------Changed in version 2.4.0:--  * Add framed view of the HTML documentation--  * Build with GHC 6.8.2 and 6.8.3 again--  * Support images in documentation comments again--  * Small improvements to the Hoogle output--  * A few bugs has been fixed---------------------------------------------------------------------------------Changed in version 2.3.0:--  * Support for GHC 6.10.1--  * Slightly improved space usage--  * Fix a bug that made hidden modules show up in the contents & index pages--  * Fix a bug that made Haddock load modules twice--  * Improvements to the Hoogle output---------------------------------------------------------------------------------Changed in version 2.2.2:--  * Relax version dependency on ghc-paths---------------------------------------------------------------------------------Changes in version 2.2.1:--  * Support for GHC 6.8.3--  * The Hoogle backend is back, thanks to Neil Mitchell. The plan is to be-    compatible with the upcoming Hoogle 4 pre-release--  * Show associated types in the documentation for class declarations--  * Show type family declarations--  * Show type equality predicates--  * Major bug fixes (#1 and #44)--  * It is no longer required to specify the path to GHC's lib dir--  * Remove unnecessary parenthesis in type signatures---------------------------------------------------------------------------------Changes in version 2.1.0:--  * Fix a bug that made links point to the defining module instead-    of the "best" one (e.g Int pointing to GHC.Base instead of Data.Int)--  * Fix a couple of smaller bugs--  * The representation of DocName was changed in the library--  * Add a flag --no-warnings for turning off warnings---------------------------------------------------------------------------------Changes in version 2.0.0.0:--  * The GHC API is used as the front-end--  * Haddock now understands all syntax understood by GHC 6.8.2--  * Haddock can generate documentation for some of the language extensions-    in GHC 6.8.2--  * Format of module attributes has changed. The only way of specifying-    module attributes is via a new OPTIONS_HADDOCK pragma. Example:-    {-# OPTIONS_HADDOCK hide, prune #-}--  * Haddock understands literate source files--  * Add a small library to read Haddock's interface files--  * Add a flag -B for passing the path to the GHC lib dir--  * Add a flag --optghc for passing options to GHC--  * Add a flag --ghc-version for printing the GHC version--  * Remove --use-package, --allow-missing-html, --ghc-pkg, in favour of only-    supporting --read-interface--  * Remove --package flag, the GHC flag -package-name can be used instead--  * Remove --no-implicit-prelude flag, the GHC flag -XNoImplicitPrelude can-    be used instead---------------------------------------------------------------------------------Changes in version 0.9:--  * Infix type operators, e.g., first :: a~>a' -> (a,b)~>(a',b)--  * Add a search box to the index page which automatically narrows-    the index to the search as you type (thanks to Neil Mitchell).--  * Add a --ghc-pkg flag--  * Add a flag --allow-missing-html--  * URL expansion for %%, %L, %{LINE}--  * added substitution %{FILE///c}--  * Lexing of /.../ is now more like '...', in that a / character must-    be matched by another / character on the same line, otherwise it-    is treated as a literal '/'.  This removes a common source of-    accidental parse errors in documentation.--  * Various bugs were fixed.--  * Cabal 1.2 is now required, and Haddock builds with GHC 6.8.x.---------------------------------------------------------------------------------Changes in version 0.8:--  * Haddock has a Cabal build system, and will build on Windows without-    Cygwin or MSYS.  GHC 6.4 or later is required.--  * New options: --comments-base, --comments-module, --comments-entity-    for generating links to pages (eg. wiki) for collecting user comments.--  * New options: --source-base, --source-module, --source-entity-    for generating links to source code.  Haddock now understands-    {-# LINE #-} pragmas, which means it can figure out the correct-    name for the source file even if the file is preprocessed.--  * Haddock generates output for populating the Hoogle search engine.--  * New markup <<url>> for including images.---------------------------------------------------------------------------------Changes in version 0.7:--  * Changes in the way Haddock decides where to direct hyperlinks.  Each entity-    is now assigned a single "home" module, and all hyperlinks are directed-    to that module.  See the docs ("Hyperlinking and re-exported entities")-    for details.--  * New options --ignore-all-exports, --hide--  * New option --use-package for creating documentation that hyperlinks to-    the HTML documentation for existing packages on your system.  It works-    by querying ghc-pkg for the location of the Haddock interface and-    HTML for the given package.--  * Parts of the HTML documentation, notably lists of instances, are-    now "collapsible" with a +/- button.  Also, the contents page is now-    in the form of tree in which subtrees can be collapsed.--  * Support for Microsoft DevHelp and HtmlHelp 2.0 formats.--  * Support for a short description for each module for the contents page.--  * Compiles with GHC 6.4+--  * Various bugfixes---------------------------------------------------------------------------------Changes in version 0.6:--  * Implicit parameters, zip comprehensions and 'mdo' are now-    supported by the parser.--  * Some lexical bugs were fixed, mainly concerning literal paragraphs-    next to non-literal paragraphs.--  * New options:  --gen-index, --use-index, --gen-contents and --use-contents,-    for generting a combined index and contents for several libraries-    from the appropriate .haddock files.--  * There is now one index rather than separate Function/Constructor and-    Type/Class indices.  Where a name refers to several entities, these-    are listed separately in the index.--  * New option: -v, elicits more verbose warnings.  Some warnings are-    now turned off by default; Haddock should be a little less noisy-    in general.--  * Markup for definition lists has been added.  See the documentation-    for details.--  * New option: --package for setting the package name.  The package-    is listed alongside each module name in the combined contents.--  * Entities which are re-exported from another package now at least-    leave a hyperlink in the generated HTML, rather than nothing at all.--  * Some fixes for bugs which caused incorrect hyperlinks in the-    generated HTML.  In particular, instances should now be linked-    correctly.--  * Some aesthetic improvements to the generated HTML.---------------------------------------------------------------------------------Changes in version 0.5:--  * Compiles with recent versions of GHC.--  * A few bugs have been fixed.--  * New labelling/linking feature (see "Anchors" in the manual).---------------------------------------------------------------------------------Changes in version 0.4:--  * Import declarations which list entities in parentheses, or with-    hiding clauses, are now properly supported.  Modulo one or two-    small infelicities, the full Haskell modules system is now supported.--  * Haddock is now more flexible about the placing of separators-    (commas, semicolons) in relation to doc comments.--  * There is support for generating and reading "interface files"-    which describe the exports of a set of modules.  This is useful-    for generating documentation which hyperlinks to-    previously-generated documentation.--  * Support for generating the extra files required by the Microsoft-    Help compiler.--  * New option: --prologue specifies a file of documentation which is-    placed on the contents page.--  * Many bugs fixed--------------------------------------------------------------------------------Changes in version 0.3:--  * Documentation on individual function arguments is now implemented--  * Links can be made to identifiers that aren't in scope, by using-    the fully qualified name.--  * Instances are collected and listed with the appropriate classes-    and datatypes (not for derived instances yet).--  * Single quotes are only interpreted specially when they surround a-    legal Haskell identifier, otherwise they are treated literally.--  * Bird-tracked text is now literal.  If you want marked-up text in-    a code block, use the @...@ notation instead.--  * Various changes to the layout, it generally looks nicer now.--  * Various bugs fixed.--------------------------------------------------------------------------------Changes in version 0.2:--  * The [...] markup for typewriter font has been changed to @...@.--  * Module attributes introduced (see the documentation for details).--  * {- ... -} style comments may now be used for documentation annotations--  * Recursive modules are detected and reported as an error.--  * Existential constructors and rank-N types are now groked by the parser--  * Some type rendering cleaned up--  * `abc' is accepted as well as 'abc' to markup an identifier--  * Several bugs fixed, and error messages improved.
+ CHANGES.md view
@@ -0,0 +1,772 @@+## Changes in version 2.18.1++ * Synopsis is working again (#599)++ * Per-argument documentation on class methods working again (#647)++ * Support user defined signatures on pattern synonyms++ * Support for bundled pattern synonyms (#494, #551, #626)++## Changes in version 2.17.4++ * Fix 'internal error: links: UnhelpfulSpan' (#554, #565)++ * Hyperlink backend knows about `DataKinds` (#510)++ * Fix rendering of class methods for `Eq` and `Ord` (#549)++ * Export `MDoc` and `toInstalledIface` from `Haddock.Types`++## Changes in version 2.17.3.1++ * Disable `NFData` instances for GHC types when GHC >= 8.0.2 (#537)++## Changes in version 2.17.3++ * Remove framed view of the HTML documentation++## Changes in version 2.17.2++ * Fix portability of documentation building within GHC++## Changes in version 2.17.1++ * Included with GHC 8.0.1++ * Fixed Makefile for GHC installation++ * Fixed clean rule of GHC Makefile++## Changes in version 2.17.0 (not released)++ * Support typesetting of mathematical expressions via Mathjax (#397)++ * Describe orphan instances defined in a module in its documentation (#449)++ * Produce specialized type signatures for typeclass methods (#425)++ * Support GCC-like response files (#470)++## Changes in version 2.16.2++ * Generate hyperlinked source ourselves (#410, part of GSOC 2015)++ * Fix expansion icon for user-collapsible sections (#412)++ * Break up response file arguments on newlines++ * Various HTML fixes (#301, #406, #407, #421)++ * Line anchors in hyperlinked source (#420)++## Changes in version 2.16.1++ * Don't default to type constructors for out-of-scope names (#253 and+   #375)++ * Fix Hoogle display of constructors (#361)++ * Fully qualify names in Hoogle instances output (#263)++ * Output method documentation in Hoogle backend (#259)++ * Don't print instance safety information in Hoogle (#168)++ * Expand response files in arguments (#285)++ * Build the main executable with -threaded (#399)++ * Use SrcSpan of declarations for inferred type sigs (#207)++ * Fix cross-module instance locations (#383)++ * Fix alignment of Source link for instances in Firefox (#384)++## Changes in version 2.16.0++ * Experimental collapsible header support (#335)++ * Add support for markdown links and images++ * Allow an optional colon after the closing bracket of definition lists.+   This is to disambiguate them from markdown links and will be require with a+   future release.++ * Fix re-exports of built-in type families (#310)++ * Fix parsing of infix identifiers such as ``elem``.++ * Print missing docs by default and add --no-print-missing-docs++ * parser: now parses out some meta data too, breaking the API++ * parser: markdown syntax for images and URLs is now accepted:+   <<foo>> style for images and <foo bar> style for links is now+   considered deprecated. <foo> for links is still OK.++ * parser: add support for @since element: this is paragraph-level+   element of the form ‘@since x.y.z’ where x.y.z is the version+   number. The way it is rendered is subject to change.++ * properly render package ID (not package key) in index (#329)++ * links to source location of class instance definitions++ * Fix code blocks in presence of Windows line endings++ * Deal better with long synopsis lines (#151)++## Changes in version 2.15.0++ * Always read in prologue files as UTF8 (#286 and Cabal #1721)++ * parser: don't wrap headers in DocParagraph (#307)++ * parser: don't mangle append order for nested lists (pandoc #1346)++ * parser: preserve list ordering in certain scenarios (#313)++ * parser: update the attoparsec version used internally giving slight+   parsing performance boost.++ * Move development to be against latest GHC release and not GHC HEAD.++ * Further split up the package to separate the executable from the+   library, necessary by things like GHCJS. We now have+   ‘haddock-library’ which are the parts that don't use GHC API,+   ‘haddock-api’ which are (some of) the parts that do use GHC API and+   ‘haddock’ which merely provides the executable.++ * Export few extra functions in the API.++ * Add compatibility with GHC 7.8.2.++ * Omit unnecessary ‘forall’s (#315 and #86)++ * Remove some files which were really old or did not belong in the+   repository in the first place.++## Changes in version 2.14.3++ * Fix parsing of identifiers with ^ or ⋆ in them (#298)++ * Fix anchors (#308)++## Changes in version 2.14.2++ * Always drop --split-objs GHC flag for performance reasons (#292)++ * Print kind signatures GADTs (#85)++ * Drop single leading whitespace when reasonable from @-style blocks (#201)++ * Fix crashes associated with exporting data family record selectors (#294)++## Changes in version 2.14.1++ * Render * and -> with their UnicodeSyntax equivalents if -U is enabled++ * Display minimal complete definitions for type classes++ * Hide right hand side of TF instances with hidden names on the RHS++## Changes in version 2.14.0++ * Print entities with missing documentation (#258)++ * Print a warning message when given `-optghc` instead of `--optghc` (#5)++ * Add `--compatible-interface-versions` (#231)++ * Allow to generate latex documentation for FFI declarations (#247)++ * Add copyright and license information to generated documentation++ * Improved to Unicode support++ * Bold markup support++ * Nested paragraphs++ * Better escaping++ * Header markup++ * Parser should no longer fail to parse any markup++ * {-# OPTIONS_HADDOCK show-extensions #-} pragma will show the GHC extensions+   enabled in the module.++ * Properly render License field (#271)++ * Print type/data family instances (for exported types only)++ * Fix display of poly-kinded type operators (#189)++ * PatternSynonyms support++ * Fix display of implicit parameters (#260)++ * Fix rendering of Contents when links are present (#276)++ * Fix documentation duplication on record fields (#195)++ * Add `--source-entity-line` for exact line links (eg. things defined+   inside TH splices) (#79)++ * Display fixity information for names with nonstandard fixities++ * Bird tracks specified like "> code" no longer suffer from an extra leading+   space in the code output++## Changes in version 2.13.2++ * Handle HsExplicitListTy in renamer (#213)++ * Allow haddock markup in deprecation messages++ * Export more types from Documentation.Haddock++ * Include everything that is required to run the test suite with the cabal+   package (#230)++## Changes in version 2.13.1++ * Hide instances that are "internal" to a module++ * Add support for properties in documentation++ * Fix a bug with spurious superclass constraints++ * Fix and extend the Haddock API++## Changes in version 2.12.0++ * Labeled URLs (e.g <http://example.net/ some label>)++ * Improved memory usage (new dependency: deepseq)++## Changes in version 2.11.0++ * Show deprecation messages for identifiers++ * List identifiers declared on the same line (with a common type) separately++ * Don't crash on unicode strings in doc comments++ * Fix reporting of modules safe haskell mode++ * Fix a case where we were generating invalid xhtml++ * Improved --qual option (no crashes, proper error messages)++ * A new --qual option "aliased" which qualifies identifiers by the module alias+   used in the source code++ * The Haddock API restores GHC's static flags after invocation++ * Access to unexported identifiers through the Haddock API again++## Changes in version 2.10.0++ * Require GHC >= 7.4++ * Safe Haskell indications on module pages++ * Type declarations on identifiers no longer necessary++ * Add flag --interface-version++ * Warn when comment refers to in-scope identifier without documentation++ * Bug fix: links to out-of-scope things (#78)++ * Bug fix: module references to other packages work again++## Changes in version 2.9.4++  * Require GHC >= 7.2++  * Support Alex 3.x++## Changes in version 2.9.3++  [This is the version that comes with GHC 7.2.1 although it claims it's 2.9.2!]++  * Build with GHC 7.2.1++  * Support blank lines in results of examples++  * A type signature for multiple names generates one signature in the output++  * Minor bug fixes++## Changes in version 2.9.2++  * Build with GHC 7.0.2++  * Write Hoogle output in utf8; fixes GHC build on Windows++## Changes in version 2.9.1++  * Fix build in GHC tree++  * Improve .cabal file++## Changes in version 2.9.0++  * Drop support for ghc < 7++  * New flag --qual for qualification of names++  * Print doc coverage information to stdout when generating docs++  * Include an 'All' option in the A-Z subdivided index++  * Make TOC group header identifiers validate++  * Minor changes to the API++## Changes in the version that comes with GHC 7.0.1++  [This version claims it is 2.8.0 but is actually based on 2.8.1]++  * Fix URL creation on Windows: Use / not \ in URLs.++  * Support GHC 7.0++## Changes in version 2.8.1++  * Fix build on Windows with MinGW++## Changes in version 2.8.0++  * HTML backend completely rewritten to generate semantically rich XHTML+    using the xhtml package.++  * New default CSS based on the color scheme chosen for the new Haskell+    wiki, with a pull-out tab for the synopsis.++  * Theme engine based on CSS files. Themes can be switched from the+    header menu. (New flags --built-in-themes and --theme. The latter+    is an alias for --css which now has extended semantics).++  * Markup support for executable examples/unit-tests. To be used with an+    upcoming version of the DocTest program.++  * Addition of a LaTeX backend.++  * Frames-mode can be enabled from the header menu.++  * Path to source entities can be specified per package, so that source+    links work for cross-package documentation.++  * Support for a second form of enumerated lists (1. 2. etc).++  * Additions and changes to the Haddock API.++  * New flag --no-tmp-comp-dir to tell Haddock to write and pick up+    compilation files (.o, .hi, etc) to/from GHC's output directory instead+    of a temporary directory.++  * Various bug fixes.++-----------------------------------------------------------------------------++## Changes in version 2.6.1 (bug fix release from the stable branch)++  * Fix #128++-----------------------------------------------------------------------------++## Changes in version 2.7.2++  * Add Paths_haddock to library++-----------------------------------------------------------------------------++## Changes in version 2.7.1:++  * Fix problems with library part of .cabal file++-----------------------------------------------------------------------------++## Changes in version 2.7.0:++  * Instances can be commented++  * The Haddock API now exposes more of the internals of Haddock++  * Bug fixes (most importantly #128)++-----------------------------------------------------------------------------++## Changes in version 2.6.0:++  * Drop support for GHC 6.10.*++  * Add support for GHC 6.12.1++  * Cross-package documentation: full documentation show up when re-exporting+    things coming from external packages++  * Lexing and parsing the Haddock comment markup is now done in Haddock+    again, instead of in GHC++  * Slightly prettier printing of instance heads++  * Support platforms for which GHC has no native code generator++  * Add a flag --print-ghc-libdir++  * Minor bug fixes++-----------------------------------------------------------------------------++Changed in version 2.5.0:++  * Drop support for GHC 6.8.*++  * Add support for GHC 6.10.3 and 6.10.4++  * Revert to the old multi-page index for large packages (#106)++  * Show GADT records in the generated documentation++  * Create output directory if it doesn't exist (#104)++  * Use the native codegen instead of compiling via C for TH modules++  * Add --use-unicode flag for displaying prettier versions of common symbols++  * Multiple verbosity levels: remove --verbose and add --verbosity=n++-----------------------------------------------------------------------------++Changed in version 2.4.2:++  * Support GHC 6.10.2++  * Haddock no longer crashes on Template Haskell modules (#68)+    (only with GHC 6.10.2 or above)++  * Fix problem with Template Haskell-generated declarations disappearing (#59)++  * Generate two anchors for each link for compatibility between IE and Opera+    (#45)++  * Improved error messages++  * Show re-exports from external packages again (GHC ticket #2746)++  * Store hidden modules in .haddock files again (needed by the haddock+    library)++  * Avoid processing boot modules++  * Pragmas may exist between document comments and declarations++  * Do not indicate that a constructor argument is unboxed++  * Fix problem with non-working links to ghc-prim++  * Allow referring to a specific section within a module in a module link+    (#65)++  * Fixes to the Hoogle backend++  * Improvements to the haddock library++  * Many other fixes (including #67, #69, #58, #57)++-----------------------------------------------------------------------------++Changed in version 2.4.1:++  * Depend on base 4.* when GHC >= 6.9, otherwise 3.*++-----------------------------------------------------------------------------++Changed in version 2.4.0:++  * Add framed view of the HTML documentation++  * Build with GHC 6.8.2 and 6.8.3 again++  * Support images in documentation comments again++  * Small improvements to the Hoogle output++  * A few bugs has been fixed++-----------------------------------------------------------------------------++Changed in version 2.3.0:++  * Support for GHC 6.10.1++  * Slightly improved space usage++  * Fix a bug that made hidden modules show up in the contents & index pages++  * Fix a bug that made Haddock load modules twice++  * Improvements to the Hoogle output++-----------------------------------------------------------------------------++Changed in version 2.2.2:++  * Relax version dependency on ghc-paths++-----------------------------------------------------------------------------++## Changes in version 2.2.1:++  * Support for GHC 6.8.3++  * The Hoogle backend is back, thanks to Neil Mitchell. The plan is to be+    compatible with the upcoming Hoogle 4 pre-release++  * Show associated types in the documentation for class declarations++  * Show type family declarations++  * Show type equality predicates++  * Major bug fixes (#1 and #44)++  * It is no longer required to specify the path to GHC's lib dir++  * Remove unnecessary parenthesis in type signatures++-----------------------------------------------------------------------------++## Changes in version 2.1.0:++  * Fix a bug that made links point to the defining module instead+    of the "best" one (e.g Int pointing to GHC.Base instead of Data.Int)++  * Fix a couple of smaller bugs++  * The representation of DocName was changed in the library++  * Add a flag --no-warnings for turning off warnings++-----------------------------------------------------------------------------++## Changes in version 2.0.0.0:++  * The GHC API is used as the front-end++  * Haddock now understands all syntax understood by GHC 6.8.2++  * Haddock can generate documentation for some of the language extensions+    in GHC 6.8.2++  * Format of module attributes has changed. The only way of specifying+    module attributes is via a new OPTIONS_HADDOCK pragma. Example:+    {-# OPTIONS_HADDOCK hide, prune #-}++  * Haddock understands literate source files++  * Add a small library to read Haddock's interface files++  * Add a flag -B for passing the path to the GHC lib dir++  * Add a flag --optghc for passing options to GHC++  * Add a flag --ghc-version for printing the GHC version++  * Remove --use-package, --allow-missing-html, --ghc-pkg, in favour of only+    supporting --read-interface++  * Remove --package flag, the GHC flag -package-name can be used instead++  * Remove --no-implicit-prelude flag, the GHC flag -XNoImplicitPrelude can+    be used instead++-----------------------------------------------------------------------------++## Changes in version 0.9:++  * Infix type operators, e.g., first :: a~>a' -> (a,b)~>(a',b)++  * Add a search box to the index page which automatically narrows+    the index to the search as you type (thanks to Neil Mitchell).++  * Add a --ghc-pkg flag++  * Add a flag --allow-missing-html++  * URL expansion for %%, %L, %{LINE}++  * added substitution %{FILE///c}++  * Lexing of /.../ is now more like '...', in that a / character must+    be matched by another / character on the same line, otherwise it+    is treated as a literal '/'.  This removes a common source of+    accidental parse errors in documentation.++  * Various bugs were fixed.++  * Cabal 1.2 is now required, and Haddock builds with GHC 6.8.x.++-----------------------------------------------------------------------------++## Changes in version 0.8:++  * Haddock has a Cabal build system, and will build on Windows without+    Cygwin or MSYS.  GHC 6.4 or later is required.++  * New options: --comments-base, --comments-module, --comments-entity+    for generating links to pages (eg. wiki) for collecting user comments.++  * New options: --source-base, --source-module, --source-entity+    for generating links to source code.  Haddock now understands+    {-# LINE #-} pragmas, which means it can figure out the correct+    name for the source file even if the file is preprocessed.++  * Haddock generates output for populating the Hoogle search engine.++  * New markup <<url>> for including images.++-----------------------------------------------------------------------------++## Changes in version 0.7:++  * ## Changes in the way Haddock decides where to direct hyperlinks.  Each entity+    is now assigned a single "home" module, and all hyperlinks are directed+    to that module.  See the docs ("Hyperlinking and re-exported entities")+    for details.++  * New options --ignore-all-exports, --hide++  * New option --use-package for creating documentation that hyperlinks to+    the HTML documentation for existing packages on your system.  It works+    by querying ghc-pkg for the location of the Haddock interface and+    HTML for the given package.++  * Parts of the HTML documentation, notably lists of instances, are+    now "collapsible" with a +/- button.  Also, the contents page is now+    in the form of tree in which subtrees can be collapsed.++  * Support for Microsoft DevHelp and HtmlHelp 2.0 formats.++  * Support for a short description for each module for the contents page.++  * Compiles with GHC 6.4+++  * Various bugfixes++-----------------------------------------------------------------------------++## Changes in version 0.6:++  * Implicit parameters, zip comprehensions and 'mdo' are now+    supported by the parser.++  * Some lexical bugs were fixed, mainly concerning literal paragraphs+    next to non-literal paragraphs.++  * New options:  --gen-index, --use-index, --gen-contents and --use-contents,+    for generting a combined index and contents for several libraries+    from the appropriate .haddock files.++  * There is now one index rather than separate Function/Constructor and+    Type/Class indices.  Where a name refers to several entities, these+    are listed separately in the index.++  * New option: -v, elicits more verbose warnings.  Some warnings are+    now turned off by default; Haddock should be a little less noisy+    in general.++  * Markup for definition lists has been added.  See the documentation+    for details.++  * New option: --package for setting the package name.  The package+    is listed alongside each module name in the combined contents.++  * Entities which are re-exported from another package now at least+    leave a hyperlink in the generated HTML, rather than nothing at all.++  * Some fixes for bugs which caused incorrect hyperlinks in the+    generated HTML.  In particular, instances should now be linked+    correctly.++  * Some aesthetic improvements to the generated HTML.++-----------------------------------------------------------------------------++## Changes in version 0.5:++  * Compiles with recent versions of GHC.++  * A few bugs have been fixed.++  * New labelling/linking feature (see "Anchors" in the manual).++-----------------------------------------------------------------------------++## Changes in version 0.4:++  * Import declarations which list entities in parentheses, or with+    hiding clauses, are now properly supported.  Modulo one or two+    small infelicities, the full Haskell modules system is now supported.++  * Haddock is now more flexible about the placing of separators+    (commas, semicolons) in relation to doc comments.++  * There is support for generating and reading "interface files"+    which describe the exports of a set of modules.  This is useful+    for generating documentation which hyperlinks to+    previously-generated documentation.++  * Support for generating the extra files required by the Microsoft+    Help compiler.++  * New option: --prologue specifies a file of documentation which is+    placed on the contents page.++  * Many bugs fixed++-----------------------------------------------------------------------------+## Changes in version 0.3:++  * Documentation on individual function arguments is now implemented++  * Links can be made to identifiers that aren't in scope, by using+    the fully qualified name.++  * Instances are collected and listed with the appropriate classes+    and datatypes (not for derived instances yet).++  * Single quotes are only interpreted specially when they surround a+    legal Haskell identifier, otherwise they are treated literally.++  * Bird-tracked text is now literal.  If you want marked-up text in+    a code block, use the @...@ notation instead.++  * Various changes to the layout, it generally looks nicer now.++  * Various bugs fixed.++-----------------------------------------------------------------------------+## Changes in version 0.2:++  * The [...] markup for typewriter font has been changed to @...@.++  * Module attributes introduced (see the documentation for details).++  * {- ... -} style comments may now be used for documentation annotations++  * Recursive modules are detected and reported as an error.++  * Existential constructors and rank-N types are now groked by the parser++  * Some type rendering cleaned up++  * `abc' is accepted as well as 'abc' to markup an identifier++  * Several bugs fixed, and error messages improved.
README.md view
@@ -1,52 +1,21 @@-# Haddock, a Haskell Documentation Tool---#### About haddock--This is Haddock, a tool for automatically generating documentation-from annotated Haskell source code.  It is primary intended for-documenting library interfaces, but it should be useful for any kind-of Haskell code.--Haddock lets you write documentation annotations next to the-definitions of functions and types in the source code, in a syntax-that is easy on the eye when writing the source code (no heavyweight-mark-up). The documentation generated by Haddock is fully hyperlinked-- click on a type name in a type signature to go straight to the-definition, and documentation, for that type.--Haddock understands Haskell's module system, so you can structure your-code however you like without worrying that internal structure will be-exposed in the generated documentation.  For example, it is common to-implement a library in several modules, but define the external API by-having a single module which re-exports parts of these implementation-modules.  Using Haddock, you can still write documentation annotations-next to the actual definitions of the functions and types in the-library, but the documentation annotations from the implementation-will be propagated to the external API when the documentation is-generated.  Abstract types and classes are handled correctly.  In-fact, even without any documentation annotations, Haddock can generate-useful documentation from your source code.+# Haddock, a Haskell Documentation Tool [![Build Status](https://travis-ci.org/haskell/haddock.svg?branch=master)](https://travis-ci.org/haskell/haddock)  -#### Documentation formats--Haddock can generate documentation in multiple formats; currently HTML-is implemented, and there is partial support for generating LaTeX and-Hoogle.+## About haddock +See [Description on Hackage](https://hackage.haskell.org/package/haddock). -#### Source code documentation+## Source code documentation -Full documentation can be found in the doc/ subdirectory, in DocBook+Full documentation can be found in the `doc/` subdirectory, in+[reStructedText format](http://www.sphinx-doc.org/en/stable/rest.html) format. --#### Contributing+## Contributing  Please create issues when you have any problems and pull requests if you have some code. -##### Hacking+## Hacking  To get started you'll need a latest GHC release installed. @@ -59,9 +28,17 @@  and then proceed using your favourite build tool. -###### Using Cabal sandboxes+#### Using [`cabal new-build`](http://cabal.readthedocs.io/en/latest/nix-local-build-overview.html)  ```bash+cabal new-build -w ghc-8.2.1+# build & run the test suite+cabal new-test -w ghc-8.2.1+```++#### Using Cabal sandboxes++```bash cabal sandbox init cabal sandbox add-source haddock-library cabal sandbox add-source haddock-api@@ -75,7 +52,7 @@ cabal test ``` -###### Using Stack+#### Using Stack  ```bash stack init@@ -85,9 +62,14 @@ stack test ``` +### Git Branches  If you're a GHC developer and want to update Haddock to work with your-changes, you should be working on `ghc-head` branch instead of master.+changes, you should be working on `ghc-head` branch instead of `master`. See instructions at https://ghc.haskell.org/trac/ghc/wiki/WorkingConventions/Git/Submodules for an example workflow.++The `master` branch usually requires a GHC from the latest GHC stable+branch. The required GHC version can be inferred from the version+bounds on `ghc` in the respective `.cabal` files.
doc/markup.rst view
@@ -8,7 +8,7 @@ type declarations, and class declarations exported by each of the modules being processed. -Documenting a top-level declaration+Documenting a Top-Level Declaration -----------------------------------  The simplest example of a documentation annotation is for documenting@@ -35,6 +35,8 @@  -  A type signature for a top-level function, +-  A definition for a top-level function with no type signature,+ -  A ``data`` declaration,  -  A ``newtype`` declaration,@@ -57,9 +59,12 @@     -- ^The 'square' function squares an integer.     square x = x * x -Note that Haddock doesn't contain a Haskell type system — if you don't-write the type signature for a function, then Haddock can't tell what-its type is and it won't be included in the documentation.+Since Haddock uses the GHC API internally, it can infer types for+top-level functions without type signatures. However, you're+encouraged to add explicit type signatures for all top-level+functions, to make your source code more readable for your users, and+at times to avoid GHC inferring overly general type signatures that+are less helpful to your users.  Documentation annotations may span several lines; the annotation continues until the first non-comment line in the source file. For@@ -81,13 +86,13 @@     square :: Int -> Int     square x = x * x -Documenting parts of a declaration+Documenting Parts of a Declaration ----------------------------------  In addition to documenting the whole declaration, in some cases we can also document individual parts of the declaration. -Class methods+Class Methods ~~~~~~~~~~~~~  Class methods are documented in the same way as top level type@@ -99,7 +104,7 @@        -- | This is the documentation for the 'g' method        g :: Int -> a -Constructors and record fields+Constructors and Record Fields ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  Constructors are documented like so: ::@@ -150,7 +155,7 @@ reason for this seemingly weird behaviour is the fact that ``someField`` is actually the same (partial) function. -Function arguments+Function Arguments ~~~~~~~~~~~~~~~~~~  Individual arguments to a function may be documented like this: ::@@ -159,7 +164,9 @@        -> Float    -- ^ The 'Float' argument        -> IO ()    -- ^ The return value -The module description+.. _module-description:++The Module Description ----------------------  A module itself may be documented with multiple fields that can then be@@ -183,50 +190,100 @@     module W where     ... -The “Module” field should be clear. It currently doesn't affect the-output of any of the backends but you might want to include it for human-information or for any other tools that might be parsing these comments+All fields are optional but they must be in order if they do appear.+Multi-line fields are accepted but the consecutive lines have to start+indented more than their label. If your label is indented one space as+is often the case with the ``--`` syntax, the consecutive lines have+to start at two spaces at the very least. For example, above we saw a+multiline ``Copyright`` field: ::++    {-|+    ...+    Copyright   : (c) Some Guy, 2013+                      Someone Else, 2014+    ...+    -}++That could equivalently be written as ::++    -- | ...+    -- Copyright:+    --  (c) Some Guy, 2013+    --  Someone Else, 2014+    -- ...++or as ::++    -- | ...+    -- Copyright: (c) Some Guy, 2013+    --     Someone Else, 2014+    -- ...++but not as ::++    -- | ...+    -- Copyright: (c) Some Guy, 2013+    -- Someone Else, 2014+    -- ...++since the ``Someone`` needs to be indented more than the+``Copyright``.++Whether new lines and other formatting in multiline fields is+preserved depends on the field type. For example, new lines in the+``Copyright`` field are preserved, but new lines in the+``Description`` field are not; leading whitespace is not preserved in+either [#backend]_. Please note that we do not enforce the format for+any of the fields and the established formats are just a convention.++.. [#backend] Technically, whitespace and newlines in the+   ``Description`` field are preserved verbatim by the HTML backend,+   but because most browsers collapse whitespace in HTML, they don't+   render as such. But other backends may render this whitespace.++Fields of the Module Description+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~++The ``Module`` field specifies the current module name. Since the module+name can be inferred automatically from the source file, it doesn't+affect the output of any of the backends. But you might want to+include it for any other tools that might be parsing these comments without the help of GHC. -The “Description” field accepts some short text which outlines the+The ``Description`` field accepts some short text which outlines the general purpose of the module. If you're generating HTML, it will show up next to the module link in the module index. -The “Copyright”, “License”, “Maintainer” and “Stability” fields should-be obvious. An alternative spelling for the “License” field is accepted-as “Licence” but the output will always prefer “License”.+The ``Copyright``, ``License``, ``Maintainer`` and ``Stability`` fields should+be obvious. An alternative spelling for the ``License`` field is accepted+as ``Licence`` but the output will always prefer ``License``. -The “Portability” field has seen varied use by different library+The ``Portability`` field has seen varied use by different library authors. Some people put down things like operating system constraints there while others put down which GHC extensions are used in the module.-Note that you might want to consider using the “show-extensions” module-flag for the latter.--Finally, a module may contain a documentation comment before the module-header, in which case this comment is interpreted by Haddock as an-overall description of the module itself, and placed in a section-entitled “Description” in the documentation for the module. All usual-Haddock markup is valid in this comment.+Note that you might want to consider using the ``show-extensions`` module+flag for the latter (see :ref:`module-attrs`). -All fields are optional but they must be in order if they do appear.-Multi-line fields are accepted but the consecutive lines have to start-indented more than their label. If your label is indented one space as-is often the case with “--” syntax, the consecutive lines have to start-at two spaces at the very least. Please note that we do not enforce the-format for any of the fields and the established formats are just a-convention.+Finally, a module may contain a documentation comment before the+module header, in which case this comment is interpreted by Haddock as+an overall description of the module itself, and placed in a section+entitled ``Description`` in the documentation for the module. All the+usual Haddock :ref:`markup` is valid in this comment. -Controlling the documentation structure+Controlling the Documentation Structure ---------------------------------------  Haddock produces interface documentation that lists only the entities-actually exported by the module. The documentation for a module will+actually exported by the module. If there is no export list then all+entities defined by the module are exported.++The documentation for a module will include *all* entities exported by that module, even if they were-re-exported by another module. The only exception is when Haddock can't+re-exported from another module. The only exception is when Haddock can't see the declaration for the re-exported entity, perhaps because it isn't part of the batch of modules currently being processed. -However, to Haddock the export list has even more significance than just+To Haddock the export list has even more significance than just specifying the entities to be included in the documentation. It also specifies the *order* that entities will be listed in the generated documentation. This leaves the programmer free to implement functions in@@ -237,10 +294,155 @@ headings, groups of functions, type signatures and declarations in comments. +In the next section we give examples illustrating most of the+structural markup features. After the examples we go into more detail+explaining the related markup, namely :ref:`section-headings`,+:ref:`named-chunks`, and :ref:`re-exporting-entire-module`.++.. _structure-examples:++Documentation Structure Examples+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~++We now give several examples that produce similar results and+illustrate most of the structural markup features. The first two+example use an export list, but the third example does not.++The first example, using an export list with :ref:`section-headings`+and inline section descriptions: ::++    module Image+      ( -- * Image importers+        --+        -- | There is a "smart" importer, 'readImage', that determines+        -- the image format from the file extension, and several+        -- "dumb" format-specific importers that decode the file at+        -- the specified type.+        readImage+      , readPngImage+      , readGifImage+      , ...+        -- * Image exporters+        -- ...+      ) where++    import Image.Types ( Image )++    -- | Read an image, guessing the format from the file name.+    readImage :: FilePath -> IO Image+    readImage = ...++    -- | Read a GIF.+    readGifImage :: FilePath -> IO Image+    readGifImage = ...++    -- | Read a PNG.+    readPngImage :: FilePath -> IO Image+    readPngImage = ...++    ...++Note that the order of the entities ``readPngImage`` and+``readGifImage`` in the export list is different from the order of the+actual declarations farther down; the order in the export list is the+order used in the generated docs. Also, the imported ``Image`` type+itself is not re-exported, so it will not be included in the rendered+docs (see :ref:`hyperlinking-re-exported`).++The second example, using an export list with a section description+defined elsewhere (the ``$imageImporters``; see :ref:`named-chunks`):+::++    module Image+      ( -- * Image importers+        --+        -- $imageImporters+        readImage+      , readPngImage+      , readGifImage+      , ...+        -- * Image exporters+        -- ...+      ) where++    import Image.Types ( Image )++    -- $imageImporters+    --+    -- There is a "smart" importer, 'readImage', that determines the+    -- image format from the file extension, and several "dumb"+    -- format-specific importers that decode the file at the specified+    -- type.++    -- | Read an image, guessing the format from the file name.+    readImage :: FilePath -> IO Image+    readImage = ...++    -- | Read a GIF.+    readGifImage :: FilePath -> IO Image+    readGifImage = ...++    -- | Read a PNG.+    readPngImage :: FilePath -> IO Image+    readPngImage = ...++    ...++This produces the same rendered docs as the first example, but the+source code itself is arguably more readable, since the documentation+for the group of importer functions is closer to their definitions.++The third example, without an export list: ::++    module Image where++    import Image.Types ( Image )++    -- * Image importers+    --+    -- $imageImporters+    --+    -- There is a "smart" importer, 'readImage', that determines the+    -- image format from the file extension, and several "dumb"+    -- format-specific importers that decode the file at the specified+    -- type.++    -- | Read an image, guessing the format from the file name.+    readImage :: FilePath -> IO Image+    readImage = ...++    -- | Read a GIF.+    readGifImage :: FilePath -> IO Image+    readGifImage = ...++    -- | Read a PNG.+    readPngImage :: FilePath -> IO Image+    readPngImage = ...++    ...++    -- * Image exporters+    -- ...++Note that the section headers (e.g. ``-- * Image importers``) now+appear in the module body itself, and that the section documentation+is still given using :ref:`named-chunks`. Unlike in the first example+when using an export list, the named chunk syntax ``$imageImporters``+*must* be used for the section documentation; attempting to use the+``-- | ...`` syntax to document the image importers here will wrongly+associate the documentation chunk with the next definition!++.. _section-headings:++Section Headings+~~~~~~~~~~~~~~~~+ You can insert headings and sub-headings in the documentation by-including annotations at the appropriate point in the export list. For-example: ::+including annotations at the appropriate point in the export list, or+in the module body directly when not using an export list. +For example: ::+     module Foo (       -- * Classes       C(..),@@ -276,7 +478,31 @@       , g       ) where -Re-exporting an entire module+When not using an export list, you may insert section headers in the+module body. Such section headers associate with all entities+declaried up until the next section header. For example: ::++    module Foo where++    -- * Classes+    class C a where ...++    -- * Types+    -- ** A data type+    data T = ...++    -- ** A record+    data R = ...++    -- * Some functions+    f :: ...+    f = ...+    g :: ...+    g = ...++.. _re-exporting-entire-module:++Re-Exporting an Entire Module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  Haskell allows you to re-export the entire contents of a module (or at@@ -292,9 +518,11 @@ Well, it depends on how the modules ``B`` and ``C`` are imported. If they are imported wholly and without any ``hiding`` qualifiers, then the documentation will just contain a cross-reference to the documentation-for ``B`` and ``C``. However, if the modules are not *completely*-re-exported, for example: ::+for ``B`` and ``C``. +However, if the modules are not *completely* re-exported, for example:+::+     module A (       module B,       module C@@ -304,48 +532,39 @@     import C (a, b)  then Haddock behaves as if the set of entities re-exported from ``B``-and ``C`` had been listed explicitly in the export list [2]_.+and ``C`` had been listed explicitly in the export list [#notImplemented]_. -.. [2]-   NOTE: this is not fully implemented at the time of writing (version-   0.2). At the moment, Haddock always inserts a cross-reference.+.. Comment: was this ever implemented? Perhaps this part of the docs+   should just be removed until it is implemented? +.. [#notImplemented] This is not implemented at the time of writing+   (Haddock version 2.17.3 with GHC 8.0.2). At the moment, Haddock+   always inserts a module cross-reference.+ The exception to this rule is when the re-exported module is declared-with the ``hide`` attribute (:ref:`module-attrs`), in which case the module is+with the ``hide`` attribute (see :ref:`module-attrs`), in which+case the module is never cross-referenced; the contents are always expanded in place in the re-exporting module. -Omitting the export list-~~~~~~~~~~~~~~~~~~~~~~~~--If there is no export list in the module, how does Haddock generate-documentation? Well, when the export list is omitted, e.g.: ::--    module Foo where--this is equivalent to an export list which mentions every entity defined-at the top level in this module, and Haddock treats it in the same way.-Furthermore, the generated documentation will retain the order in which-entities are defined in the module. In this special case the module body-may also include section headings (normally they would be ignored by-Haddock). ::--    module Foo where--    -- * This heading will now appear before foo.+.. _named-chunks: -    -- | Documentation for 'foo'.-    foo :: Integer-    foo = 5+(Named) Chunks of Documentation+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Named chunks of documentation------------------------------+It is often desirable to include a chunk of documentation which is not+attached to any particular Haskell declaration, for example, when+giving summary documentation for a group of related definitions (see+:ref:`structure-examples`). In addition to including such documenation+chunks at the top of the file, as part of the+:ref:`module-description`, you can also associate them with+:ref:`section-headings`. -Occasionally it is desirable to include a chunk of documentation which-is not attached to any particular Haskell declaration. There are two-ways to do this:+There are several ways to associate documentation chunks with section+headings, depending on whether you are using an export list or not: --  The documentation can be included in the export list directly, e.g.: ::+-  The documentation can be included in the export list directly, by+   preceding it with a ``-- |``. For example: ::         module Foo (           -- * A section heading@@ -354,11 +573,13 @@           ...         ) where +   In this case the chunk is not "named".+ -  If the documentation is large and placing it inline in the export    list might bloat the export list and obscure the structure, then it    can be given a name and placed out of line in the body of the module.    This is achieved with a special form of documentation annotation-   “``-- $``”: ::+   ``-- $``, which we call a *named chunk*: ::         module Foo (           -- * A section heading@@ -371,11 +592,48 @@        -- Here is a large chunk of documentation which may be referred to by        -- the name $doc. -   The documentation chunk is given a name, which is the sequence of-   alphanumeric characters directly after the “``-- $``”, and it may be-   referred to by the same name in the export list.+   The documentation chunk is given a name of your choice (here+   ``doc``), which is the sequence of alphanumeric characters directly+   after the ``-- $``, and it may be referred to by the same name in+   the export list. Note that named chunks must come *after* any+   imports in the module body. -Hyperlinking and re-exported entities+-  If you aren't using an export list, then your only choice is to use+   a named chunk with the ``-- $`` syntax. For example: ::++       module Foo where++       -- * A section heading+       --+       -- $doc+       -- Here is a large chunk of documentation which may be referred to by+       -- the name $doc.++   Just like with entity declariations when not using an export list,+   named chunks of documentation are associated with the preceding+   section header here, or with the implicit top-level documentation+   section if there is no preceding section header.++   **Warning**: the form used in the first bullet above, where the+   chunk is not named, *does not work* when you aren't using an+   export list. For example ::++       module Foo where++       -- * A section heading+       --+       -- | Some documentation not attached to a particular Haskell entity++       -- | The fooifier.+       foo :: ...++   will result in ``Some documentation not ...`` being attached to+   *next* entity declaration, here ``foo``, in addition to any other+   documentation that next entity already has!++.. _hyperlinking-re-exported:++Hyperlinking and Re-Exported Entities -------------------------------------  When Haddock renders a type in the generated documentation, it@@ -455,26 +713,27 @@  The following attributes are currently understood by Haddock: -``hide`` ``hide``+``hide``     Omit this module from the generated documentation, but nevertheless     propagate definitions and documentation from within this module to     modules that re-export those definitions. -``hide`` ``prune``+``prune``     Omit definitions that have no documentation annotations from the     generated documentation. -``ignore-exports`` ``ignore-exports``+``ignore-exports``     Ignore the export list. Generate documentation as if the module had     no export list - i.e. all the top-level declarations are exported,     and section headings may be given in the body of the module. -``not-home`` ``not-home``+``not-home``     Indicates that the current module should not be considered to be the     home module for each entity it exports, unless that entity is not-    exported from any other module. See ? for more details.+    exported from any other module. See :ref:`hyperlinking-re-exported`+    for more details. -``show-extensions`` ``show-extensions``+``show-extensions``     Indicates that we should render the extensions used in this module     in the resulting documentation. This will only render if the output     format supports it. If Language is set, it will be shown as well and@@ -482,6 +741,8 @@     be rendered, including those implied by their more powerful     versions. +.. _markup:+ Markup ------ @@ -497,7 +758,7 @@ One or more blank lines separates two paragraphs in a documentation comment. -Special characters+Special Characters ~~~~~~~~~~~~~~~~~~  The following characters have special meanings in documentation@@ -514,7 +775,7 @@ beginning of a line. To escape it, just prefix the characters in the sequence with a backslash. -Character references+Character References ~~~~~~~~~~~~~~~~~~~~  Although Haskell source files may contain any character from the Unicode@@ -546,7 +807,9 @@ There is an important difference between the two forms of code block: in the bird-track form, the text to the right of the ‘\ ``>``\ ’ is interpreted literally, whereas the ``@...@`` form interprets markup as-normal inside the code block.+normal inside the code block. In particular, ``/`` is markup for italics,+and so e.g. ``@x / y / z@`` renders as ``x`` followed by italic+``y`` with no slashes, followed by ``z``.  Examples ~~~~~~~~@@ -621,7 +884,7 @@    because strictly speaking the ````` character should not be used as a    left quote, it is a grave accent. -Emphasis, Bold and Monospaced text+Emphasis, Bold and Monospaced Text ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  Emphasis may be added by surrounding text with ``/.../``. Other markup@@ -637,9 +900,10 @@ Monospaced (or typewriter) text is indicated by surrounding it with ``@...@``. Other markup is valid inside a monospaced span: for example ``@'f' a b@`` will hyperlink the identifier ``f`` inside the code-fragment.+fragment, but ``@__FILE__@`` will render ``FILE`` in bold with no +underscores, which may not be what you had in mind. -Linking to modules+Linking to Modules ~~~~~~~~~~~~~~~~~~  Linking to a module is done by surrounding the module name with double@@ -652,7 +916,7 @@ whether the module is in scope isn't checked and will always be turned into a link. -Itemized and Enumerated lists+Itemized and Enumerated Lists ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  A bulleted item is represented by preceding a paragraph with either@@ -732,7 +996,7 @@         * bar     -} -Definition lists+Definition Lists ~~~~~~~~~~~~~~~~  Definition lists are written as follows: ::@@ -833,7 +1097,7 @@ Headings ~~~~~~~~ -Headings inside of comment documentation are possible be preceding them+Headings inside of comment documentation are possible by preceding them with a number of ``=``\ s. From 1 to 6 are accepted. Extra ``=``\ s will be treated as belonging to the text of the heading. Note that it's up to the output format to decide how to render the different levels. ::
haddock-api/src/Haddock.hs view
@@ -68,7 +68,6 @@ import GHC hiding (verbosity) import Config import DynFlags hiding (projectVersion, verbosity)-import StaticFlags (discardStaticFlags) import Packages import Panic (handleGhcException) import Module@@ -398,30 +397,21 @@     ghcMode   = CompManager,     ghcLink   = NoLink     }-  let dynflags'' = gopt_unset dynflags' Opt_SplitObjs-  defaultCleanupHandler dynflags'' $ do-      -- ignore the following return-value, which is a list of packages-      -- that may need to be re-linked: Haddock doesn't do any-      -- dynamic or static linking at all!-      _ <- setSessionDynFlags dynflags''-      ghcActs dynflags''+  let dynflags'' = updOptLevel 0 $ gopt_unset dynflags' Opt_SplitObjs++  -- ignore the following return-value, which is a list of packages+  -- that may need to be re-linked: Haddock doesn't do any+  -- dynamic or static linking at all!+  _ <- setSessionDynFlags dynflags''+  ghcActs dynflags''   where     parseGhcFlags :: MonadIO m => DynFlags -> m DynFlags     parseGhcFlags dynflags = do       -- TODO: handle warnings? -      -- NOTA BENE: We _MUST_ discard any static flags here, because we cannot-      -- rely on Haddock to parse them, as it only parses the DynFlags. Yet if-      -- we pass any, Haddock will fail. Since StaticFlags are global to the-      -- GHC invocation, there's also no way to reparse/save them to set them-      -- again properly.-      ---      -- This is a bit of a hack until we get rid of the rest of the remaining-      -- StaticFlags. See GHC issue #8276.-      let flags' = discardStaticFlags flags-      (dynflags', rest, _) <- parseDynamicFlags dynflags (map noLoc flags')+      (dynflags', rest, _) <- parseDynamicFlags dynflags (map noLoc flags)       if not (null rest)-        then throwE ("Couldn't parse GHC options: " ++ unwords flags')+        then throwE ("Couldn't parse GHC options: " ++ unwords flags)         else return dynflags'  -------------------------------------------------------------------------------@@ -436,15 +426,22 @@ #ifdef IN_GHC_TREE       getInTreeDir #else-      d <- getDataDir -- provided by Cabal-      doesDirectoryExist d >>= \exists -> case exists of-        True -> return d-        False -> do-          -- If directory does not exist then we are probably invoking from-          -- ./dist/build/haddock/haddock so we use ./resources as a fallback.-          doesDirectoryExist "resources" >>= \exists_ -> case exists_ of-            True -> return "resources"-            False -> die ("Haddock's resource directory (" ++ d ++ ") does not exist!\n")+      -- if data directory does not exist we are probably+      -- invoking from either ./haddock-api or ./+      let res_dirs = [ getDataDir -- provided by Cabal+                     , pure "resources"+                     , pure "haddock-api/resources"+                     ]++          check get_path = do+            p <- get_path+            exists <- doesDirectoryExist p+            pure $ if exists then Just p else Nothing++      dirs <- mapM check res_dirs  +      case [p | Just p <- dirs] of+        (p : _) -> return p +        _       -> die "Haddock's resource directory does not exist!\n" #endif     fs -> return (last fs) @@ -492,7 +489,7 @@    when ((Flag_GenIndex `elem` flags || Flag_GenContents `elem` flags)         && Flag_Html `elem` flags) $-    throwE "-h cannot be used with --gen-index or --gen-contents"+    throwE "-h/--html cannot be used with --gen-index or --gen-contents"    when ((Flag_GenIndex `elem` flags || Flag_GenContents `elem` flags)         && Flag_Hoogle `elem` flags) $@@ -550,9 +547,10 @@ getPrologue dflags flags =   case [filename | Flag_Prologue filename <- flags ] of     [] -> return Nothing-    [filename] -> withFile filename ReadMode $ \h -> do+    [filename] -> do+      h <- openFile filename ReadMode       hSetEncoding h utf8-      str <- hGetContents h+      str <- hGetContents h -- semi-closes the handle       return . Just $! parseParas dflags str     _ -> throwE "multiple -p/--prologue options" @@ -576,7 +574,15 @@           _ | ret < size -> fmap (Just . dropFileName) $ peekCWString buf             | otherwise  -> try_size (size * 2) -foreign import stdcall unsafe "windows.h GetModuleFileNameW"+# if defined(i386_HOST_ARCH)+#  define WINDOWS_CCONV stdcall+# elif defined(x86_64_HOST_ARCH)+#  define WINDOWS_CCONV ccall+# else+#  error Unknown mingw32 arch+# endif++foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW"   c_GetModuleFileName :: Ptr () -> CWString -> Word32 -> IO Word32 #else getExecDir = return Nothing
haddock-api/src/Haddock/Backends/Hoogle.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE FlexibleContexts #-} ----------------------------------------------------------------------------- -- | -- Module      :  Haddock.Backends.Hoogle@@ -15,12 +16,13 @@     ppHoogle   ) where -import BasicTypes (OverlapFlag(..), OverlapMode(..))+import BasicTypes (OverlapFlag(..), OverlapMode(..), SourceText(..)) import InstEnv (ClsInst(..)) import Haddock.GhcUtils import Haddock.Types hiding (Version) import Haddock.Utils hiding (out) +import HsBinds (emptyLHsBinds) import GHC import Outputable import NameSet@@ -84,7 +86,8 @@         f (HsDocTy a _) = f $ unL a         f x = x -outHsType :: OutputableBndr a => DynFlags -> HsType a -> String+outHsType :: (OutputableBndrId a)+          => DynFlags -> HsType a -> String outHsType dflags = out dflags . dropHsDocTy  @@ -155,7 +158,9 @@  -- note: does not yet output documentation for class methods ppClass :: DynFlags -> TyClDecl Name -> [(Name, DocForDecl Name)] -> [String]-ppClass dflags decl subdocs = (out dflags decl{tcdSigs=[]} ++ ppTyFams) :  ppMethods+ppClass dflags decl subdocs =+  (out dflags decl{tcdSigs=[], tcdATs=[], tcdATDefs=[], tcdMeths=emptyLHsBinds}+    ++ ppTyFams) :  ppMethods     where          ppMethods = concat . map (ppSig' . unLoc . add_ctxt) $ tcdSigs decl@@ -180,6 +185,7 @@         tyFamEqnToSyn tfe = SynDecl             { tcdLName = tfe_tycon tfe             , tcdTyVars = tfe_pats tfe+            , tcdFixity = tfe_fixity tfe             , tcdRhs = tfe_rhs tfe             , tcdFVs = emptyNameSet             }@@ -194,7 +200,7 @@     -- safety information to a state where the Outputable instance     -- produces no output which means no overlap and unsafe (or [safe]     -- is generated).-    cls = x { is_flag = OverlapFlag { overlapMode = NoOverlap mempty+    cls = x { is_flag = OverlapFlag { overlapMode = NoOverlap NoSourceText                                     , isSafeOverlap = False } }  ppSynonym :: DynFlags -> TyClDecl Name -> [String]@@ -202,7 +208,7 @@  ppData :: DynFlags -> TyClDecl Name -> [(Name, DocForDecl Name)] -> [String] ppData dflags decl@(DataDecl { tcdDataDefn = defn }) subdocs-    = showData decl{ tcdDataDefn = defn { dd_cons=[],dd_derivs=Nothing }} :+    = showData decl{ tcdDataDefn = defn { dd_cons=[],dd_derivs=noLoc [] }} :       concatMap (ppCtor dflags decl subdocs . unL) (dd_cons defn)     where @@ -242,7 +248,7 @@         -- docs for con_names on why it is a list to begin with.         name = commaSeparate dflags . map unL $ getConNames con -        resType = apps $ map (reL . HsTyVar . reL) $+        resType = apps $ map (reL . HsTyVar NotPromoted . reL) $                         (tcdName dat) : [hsTyVarName v | L _ v@(UserTyVar _) <- hsQTvExplicit $ tyClDeclTyVars dat]  ppCtor dflags _dat subdocs con@ConDeclGADT {}
haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs view
@@ -2,12 +2,12 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-}-+{-# LANGUAGE TypeApplications #-}  module Haddock.Backends.Hyperlinker.Ast (enrich) where  -import Haddock.Syb+import qualified Haddock.Syb as Syb import Haddock.Backends.Hyperlinker.Types  import qualified GHC@@ -16,6 +16,9 @@ import Data.Data import Data.Maybe +everythingInRenamedSource :: (Alternative f, Data x)+  => (forall a. Data a => a -> f r) -> x -> f r+everythingInRenamedSource f = Syb.everythingButType @GHC.Name (<|>) f  -- | Add more detailed information to token stream using GHC API. enrich :: GHC.RenamedSource -> [Token] -> [RichToken]@@ -53,7 +56,7 @@ -- | Obtain details map for variables ("normally" used identifiers). variables :: GHC.RenamedSource -> DetailsMap variables =-    everything (<|>) (var `combine` rec)+    everythingInRenamedSource (var `Syb.combine` rec)   where     var term = case cast term of         (Just (GHC.L sspan (GHC.HsVar name))) ->@@ -68,11 +71,10 @@  -- | Obtain details map for types. types :: GHC.RenamedSource -> DetailsMap-types =-    everything (<|>) ty+types = everythingInRenamedSource ty   where     ty term = case cast term of-        (Just (GHC.L sspan (GHC.HsTyVar name))) ->+        (Just (GHC.L sspan (GHC.HsTyVar _ name))) ->             pure (sspan, RtkType (GHC.unLoc name))         _ -> empty @@ -81,9 +83,10 @@ -- That includes both identifiers bound by pattern matching or declared using -- ordinary assignment (in top-level declarations, let-expressions and where -- clauses).+ binds :: GHC.RenamedSource -> DetailsMap-binds =-    everything (<|>) (fun `combine` pat `combine` tvar)+binds = everythingInRenamedSource+      (fun `Syb.combine` pat `Syb.combine` tvar)   where     fun term = case cast term of         (Just (GHC.FunBind (GHC.L sspan name) _ _ _ _ :: GHC.HsBind GHC.Name)) ->@@ -93,7 +96,7 @@         (Just (GHC.L sspan (GHC.VarPat name))) ->             pure (sspan, RtkBind (GHC.unLoc name))         (Just (GHC.L _ (GHC.ConPatIn (GHC.L sspan name) recs))) ->-            [(sspan, RtkVar name)] ++ everything (<|>) rec recs+            [(sspan, RtkVar name)] ++ everythingInRenamedSource rec recs         (Just (GHC.L _ (GHC.AsPat (GHC.L sspan name) _))) ->             pure (sspan, RtkBind name)         _ -> empty@@ -112,13 +115,13 @@ decls :: GHC.RenamedSource -> DetailsMap decls (group, _, _, _) = concatMap ($ group)     [ concat . map typ . concat . map GHC.group_tyclds . GHC.hs_tyclds-    , everything (<|>) fun . GHC.hs_valds-    , everything (<|>) (con `combine` ins)+    , everythingInRenamedSource fun . GHC.hs_valds+    , everythingInRenamedSource (con `Syb.combine` ins)     ]   where     typ (GHC.L _ t) = case t of         GHC.DataDecl { tcdLName = name } -> pure . decl $ name-        GHC.SynDecl name _ _ _ -> pure . decl $ name+        GHC.SynDecl name _ _ _ _ -> pure . decl $ name         GHC.FamDecl fam -> pure . decl $ GHC.fdLName fam         GHC.ClassDecl{..} -> [decl tcdLName] ++ concatMap sig tcdSigs     fun term = case cast term of@@ -127,7 +130,8 @@         _ -> empty     con term = case cast term of         (Just cdcl) ->-            map decl (GHC.getConNames cdcl) ++ everything (<|>) fld cdcl+            map decl (GHC.getConNames cdcl)+              ++ everythingInRenamedSource fld cdcl         Nothing -> empty     ins term = case cast term of         (Just (GHC.DataFamInstD inst)) -> pure . tyref $ GHC.dfid_tycon inst@@ -149,14 +153,14 @@ -- import lists. imports :: GHC.RenamedSource -> DetailsMap imports src@(_, imps, _, _) =-    everything (<|>) ie src ++ mapMaybe (imp . GHC.unLoc) imps+    everythingInRenamedSource ie src ++ mapMaybe (imp . GHC.unLoc) imps   where     ie term = case cast term of-        (Just (GHC.IEVar v)) -> pure $ var v-        (Just (GHC.IEThingAbs t)) -> pure $ typ t-        (Just (GHC.IEThingAll t)) -> pure $ typ t+        (Just (GHC.IEVar v)) -> pure $ var $ GHC.ieLWrappedName v+        (Just (GHC.IEThingAbs t)) -> pure $ typ $ GHC.ieLWrappedName t+        (Just (GHC.IEThingAll t)) -> pure $ typ $ GHC.ieLWrappedName t         (Just (GHC.IEThingWith t _ vs _fls)) ->-          [typ t] ++ map var vs+          [typ $ GHC.ieLWrappedName t] ++ map (var . GHC.ieLWrappedName) vs         _ -> empty     typ (GHC.L sspan name) = (sspan, RtkType name)     var (GHC.L sspan name) = (sspan, RtkVar name)
haddock-api/src/Haddock/Backends/LaTeX.hs view
@@ -227,8 +227,8 @@ processExport :: ExportItem DocName -> LaTeX processExport (ExportGroup lev _id0 doc)   = ppDocGroup lev (docToLaTeX doc)-processExport (ExportDecl decl doc subdocs insts fixities _splice)-  = ppDecl decl doc insts subdocs fixities+processExport (ExportDecl decl pats doc subdocs insts fixities _splice)+  = ppDecl decl pats doc insts subdocs fixities processExport (ExportNoDecl y [])   = ppDocName y processExport (ExportNoDecl y subs)@@ -251,7 +251,7 @@ declNames (L _ decl) = case decl of   TyClD d  -> [tcdName d]   SigD (TypeSig lnames _ ) -> map unLoc lnames-  SigD (PatSynSig lname _) -> [unLoc lname]+  SigD (PatSynSig lnames _) -> map unLoc lnames   ForD (ForeignImport (L _ n) _ _ _) -> [n]   ForD (ForeignExport (L _ n) _ _ _) -> [n]   _ -> error "declaration not supported by declNames"@@ -278,16 +278,17 @@   ppDecl :: LHsDecl DocName+       -> [(HsDecl DocName,DocForDecl DocName)]        -> DocForDecl DocName        -> [DocInstance DocName]        -> [(DocName, DocForDecl DocName)]        -> [(DocName, Fixity)]        -> LaTeX -ppDecl (L loc decl) (doc, fnArgsDoc) instances subdocs _fixities = case decl of+ppDecl (L loc decl) pats (doc, fnArgsDoc) instances subdocs _fixities = case decl of   TyClD d@(FamDecl {})          -> ppTyFam False loc doc d unicode   TyClD d@(DataDecl {})-                                -> ppDataDecl instances subdocs loc (Just doc) d unicode+                                -> ppDataDecl pats instances subdocs loc (Just doc) d unicode   TyClD d@(SynDecl {})          -> ppTySyn loc (doc, fnArgsDoc) d unicode -- Family instances happen via FamInst now --  TyClD d@(TySynonym {})@@ -296,10 +297,11 @@   TyClD d@(ClassDecl {})    -> ppClassDecl instances loc doc subdocs d unicode   SigD (TypeSig lnames t)   -> ppFunSig loc (doc, fnArgsDoc) (map unLoc lnames)                                         (hsSigWcType t) unicode-  SigD (PatSynSig lname ty) ->-      ppLPatSig loc (doc, fnArgsDoc) lname ty unicode+  SigD (PatSynSig lnames ty) ->+      ppLPatSig loc (doc, fnArgsDoc) (map unLoc lnames) ty unicode   ForD d                         -> ppFor loc (doc, fnArgsDoc) d unicode   InstD _                        -> empty+  DerivD _                       -> empty   _                              -> error "declaration not supported by ppDecl"   where     unicode = False@@ -354,14 +356,14 @@  where    names = map getName docnames -ppLPatSig :: SrcSpan -> DocForDecl DocName -> Located DocName+ppLPatSig :: SrcSpan -> DocForDecl DocName -> [DocName]           -> LHsSigType DocName           -> Bool -> LaTeX-ppLPatSig _loc (doc, _argDocs) (L _ name) ty unicode+ppLPatSig _loc (doc, _argDocs) docnames ty unicode   = declWithDoc pref1 (documentationToLaTeX doc)   where     pref1 = hsep [ keyword "pattern"-                 , ppDocBinder name+                 , hsep $ punctuate comma $ map ppDocBinder docnames                  , dcolon unicode                  , ppLType unicode (hsSigType ty)                  ]@@ -564,11 +566,11 @@ -------------------------------------------------------------------------------  -ppDataDecl :: [DocInstance DocName] ->+ppDataDecl :: [(HsDecl DocName,DocForDecl DocName)] -> [DocInstance DocName] ->               [(DocName, DocForDecl DocName)] -> SrcSpan ->               Maybe (Documentation DocName) -> TyClDecl DocName -> Bool ->               LaTeX-ppDataDecl instances subdocs _loc doc dataDecl unicode+ppDataDecl pats instances subdocs _loc doc dataDecl unicode     =  declWithDoc (ppDataHeader dataDecl unicode <+> whereBit)                   (if null body then Nothing else Just (vcat body))@@ -578,10 +580,12 @@     cons      = dd_cons (tcdDataDefn dataDecl)     resTy     = (unLoc . head) cons -    body = catMaybes [constrBit, doc >>= documentationToLaTeX]+    body = catMaybes [constrBit,patternBit, doc >>= documentationToLaTeX]      (whereBit, leaders)-      | null cons = (empty,[])+      | null cons+      , null pats = (empty,[])+      | null cons = (decltt (keyword "where"), repeat empty)       | otherwise = case resTy of         ConDeclGADT{} -> (decltt (keyword "where"), repeat empty)         _             -> (empty, (decltt (text "=") : repeat (decltt (text "|"))))@@ -593,6 +597,19 @@           vcat (zipWith (ppSideBySideConstr subdocs unicode) leaders cons) $$           text "\\end{tabulary}\\par" +    patternBit+      | null cons = Nothing+      | otherwise = Just $+          text "\\haddockbeginconstrs" $$+          vcat [ hsep [ keyword "pattern"+                      , hsep $ punctuate comma $ map (ppDocBinder . unLoc) lnames+                      , dcolon unicode+                      , ppLType unicode (hsSigType ty)+                      ] <-> rDoc (fmap _doc . combineDocumentation . fst $ d)+               | (SigD (PatSynSig lnames ty),d) <- pats+               ] $$+          text "\\end{tabulary}\\par"+     instancesBit = ppDocInstances unicode instances  @@ -884,6 +901,10 @@ tupleParens _              = parenList  +sumParens :: [LaTeX] -> LaTeX+sumParens = ubxparens . hsep . punctuate (text " | ")++ ------------------------------------------------------------------------------- -- * Rendering of HsType --@@ -944,17 +965,20 @@         , ppr_mono_lty pREC_TOP ty unicode ]  ppr_mono_ty _         (HsBangTy b ty)     u = ppBang b <> ppLParendType u ty-ppr_mono_ty _         (HsTyVar (L _ name)) _ = ppDocName name+ppr_mono_ty _         (HsTyVar NotPromoted (L _ name)) _ = ppDocName name+ppr_mono_ty _         (HsTyVar Promoted    (L _ name)) _ = char '\'' <> ppDocName name ppr_mono_ty ctxt_prec (HsFunTy ty1 ty2)   u = ppr_fun_ty ctxt_prec ty1 ty2 u ppr_mono_ty _         (HsTupleTy con tys) u = tupleParens con (map (ppLType u) tys)+ppr_mono_ty _         (HsSumTy tys) u       = sumParens (map (ppLType u) tys) ppr_mono_ty _         (HsKindSig ty kind) u = parens (ppr_mono_lty pREC_TOP ty u <+> dcolon u <+> ppLKind u kind) ppr_mono_ty _         (HsListTy ty)       u = brackets (ppr_mono_lty pREC_TOP ty u) ppr_mono_ty _         (HsPArrTy ty)       u = pabrackets (ppr_mono_lty pREC_TOP ty u)-ppr_mono_ty _         (HsIParamTy n ty)   u = brackets (ppIPName n <+> dcolon u <+> ppr_mono_lty pREC_TOP ty u)+ppr_mono_ty _         (HsIParamTy (L _ n) ty) u = brackets (ppIPName n <+> dcolon u <+> ppr_mono_lty pREC_TOP ty u) ppr_mono_ty _         (HsSpliceTy {})     _ = error "ppr_mono_ty HsSpliceTy" ppr_mono_ty _         (HsRecTy {})        _ = error "ppr_mono_ty HsRecTy" ppr_mono_ty _         (HsCoreTy {})       _ = error "ppr_mono_ty HsCoreTy"-ppr_mono_ty _         (HsExplicitListTy _ tys) u = Pretty.quote $ brackets $ hsep $ punctuate comma $ map (ppLType u) tys+ppr_mono_ty _         (HsExplicitListTy Promoted _ tys) u = Pretty.quote $ brackets $ hsep $ punctuate comma $ map (ppLType u) tys+ppr_mono_ty _         (HsExplicitListTy NotPromoted _ tys) u = brackets $ hsep $ punctuate comma $ map (ppLType u) tys ppr_mono_ty _         (HsExplicitTupleTy _ tys) u = Pretty.quote $ parenList $ map (ppLType u) tys  ppr_mono_ty ctxt_prec (HsEqTy ty1 ty2) unicode
haddock-api/src/Haddock/Backends/Xhtml.hs view
@@ -46,7 +46,7 @@ import Data.Ord              ( comparing )  import DynFlags (Language(..))-import GHC hiding ( NoLink, moduleInfo )+import GHC hiding ( NoLink, moduleInfo,LexicalFixity(..) ) import Name import Module @@ -108,8 +108,8 @@   return ()  -headHtml :: String -> Maybe String -> Themes -> Maybe String -> Html-headHtml docTitle miniPage themes mathjax_url =+headHtml :: String -> Themes -> Maybe String -> Html+headHtml docTitle themes mathjax_url =   header << [     meta ! [httpequiv "Content-Type", content "text/html; charset=UTF-8"],     thetitle << docTitle,@@ -118,15 +118,12 @@     script ! [src mjUrl, thetype "text/javascript"] << noHtml,     script ! [thetype "text/javascript"]         -- NB: Within XHTML, the content of script tags needs to be-        -- a <![CDATA[ section. Will break if the miniPage name could-        -- have "]]>" in it!-      << primHtml (-          "//<![CDATA[\nwindow.onload = function () {pageLoad();"-          ++ setSynopsis ++ "};\n//]]>\n")+        -- a <![CDATA[ section.+      << primHtml+          "//<![CDATA[\nwindow.onload = function () {pageLoad();};\n//]]>\n"     ]   where-    setSynopsis = maybe "" (\p -> "setSynopsis(\"" ++ p ++ "\");") miniPage-    mjUrl = maybe "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" id mathjax_url+    mjUrl = maybe "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" id mathjax_url   srcButton :: SourceURLs -> Maybe Interface -> Maybe Html@@ -172,7 +169,7 @@            maybe_source_url maybe_wiki_url            maybe_contents_url maybe_index_url            pageContent =-  body ! [theclass "no-frame"] << [+  body << [     divPackageHeader << [       unordList (catMaybes [         srcButton maybe_source_url iface,@@ -263,13 +260,20 @@   themes mathjax_url maybe_index_url   maybe_source_url maybe_wiki_url ifaces showPkgs prologue debug qual = do   let tree = mkModuleTree dflags showPkgs-         [(instMod iface, toInstalledDescription iface) | iface <- ifaces]+         [(instMod iface, toInstalledDescription iface)+         | iface <- ifaces+         , not (instIsSig iface)]+      sig_tree = mkModuleTree dflags showPkgs+         [(instMod iface, toInstalledDescription iface)+         | iface <- ifaces+         , instIsSig iface]       html =-        headHtml doctitle Nothing themes mathjax_url ++++        headHtml doctitle themes mathjax_url +++         bodyHtml doctitle Nothing           maybe_source_url maybe_wiki_url           Nothing maybe_index_url << [             ppPrologue qual doctitle prologue,+            ppSignatureTree qual sig_tree,             ppModuleTree qual tree           ]   createDirectoryIfMissing True odir@@ -282,7 +286,13 @@   divDescription << (h1 << title +++ docElement thediv (rdrDocToHtml qual doc))  +ppSignatureTree :: Qualification -> [ModuleTree] -> Html+ppSignatureTree qual ts =+  divModuleList << (sectionName << "Signatures" +++ mkNodeList qual [] "n" ts)++ ppModuleTree :: Qualification -> [ModuleTree] -> Html+ppModuleTree _ [] = mempty ppModuleTree qual ts =   divModuleList << (sectionName << "Modules" +++ mkNodeList qual [] "n" ts) @@ -359,7 +369,7 @@    where     indexPage showLetters ch items =-      headHtml (doctitle ++ " (" ++ indexName ch ++ ")") Nothing themes maybe_mathjax_url ++++      headHtml (doctitle ++ " (" ++ indexName ch ++ ")") themes maybe_mathjax_url +++       bodyHtml doctitle Nothing         maybe_source_url maybe_wiki_url         maybe_contents_url Nothing << [@@ -469,32 +479,31 @@       mdl = ifaceMod iface       aliases = ifaceModuleAliases iface       mdl_str = moduleString mdl+      mdl_str_annot = mdl_str ++ if ifaceIsSig iface+                                    then " (signature)"+                                    else ""+      mdl_str_linked+        | ifaceIsSig iface+        = mdl_str +++ " (signature" ++++                       sup << ("[" +++ anchor ! [href signatureDocURL] << "?" +++ "]" ) ++++                       ")"+        | otherwise+        = toHtml mdl_str       real_qual = makeModuleQual qual aliases mdl       html =-        headHtml mdl_str (Just $ "mini_" ++ moduleHtmlFile mdl) themes maybe_mathjax_url ++++        headHtml mdl_str_annot themes maybe_mathjax_url +++         bodyHtml doctitle (Just iface)           maybe_source_url maybe_wiki_url           maybe_contents_url maybe_index_url << [-            divModuleHeader << (moduleInfo iface +++ (sectionName << mdl_str)),+            divModuleHeader << (moduleInfo iface +++ (sectionName << mdl_str_linked)),             ifaceToHtml maybe_source_url maybe_wiki_url iface unicode real_qual           ]    createDirectoryIfMissing True odir   writeFile (joinPath [odir, moduleHtmlFile mdl]) (renderToString debug html)-  ppHtmlModuleMiniSynopsis odir doctitle themes maybe_mathjax_url iface unicode real_qual debug -ppHtmlModuleMiniSynopsis :: FilePath -> String -> Themes-  -> Maybe String -> Interface -> Bool -> Qualification -> Bool -> IO ()-ppHtmlModuleMiniSynopsis odir _doctitle themes maybe_mathjax_url iface unicode qual debug = do-  let mdl = ifaceMod iface-      html =-        headHtml (moduleString mdl) Nothing themes maybe_mathjax_url +++-        miniBody <<-          (divModuleHeader << sectionName << moduleString mdl +++-           miniSynopsis mdl iface unicode qual)-  createDirectoryIfMissing True odir-  writeFile (joinPath [odir, "mini_" ++ moduleHtmlFile mdl]) (renderToString debug html)-+signatureDocURL :: String+signatureDocURL = "https://wiki.haskell.org/Module_signature"  ifaceToHtml :: SourceURLs -> WikiURLs -> Interface -> Bool -> Qualification -> Html ifaceToHtml maybe_source_url maybe_wiki_url iface unicode qual@@ -546,43 +555,6 @@     linksInfo = (maybe_source_url, maybe_wiki_url)  -miniSynopsis :: Module -> Interface -> Bool -> Qualification -> Html-miniSynopsis mdl iface unicode qual =-    divInterface << concatMap (processForMiniSynopsis mdl unicode qual) exports-  where-    exports = numberSectionHeadings (ifaceRnExportItems iface)---processForMiniSynopsis :: Module -> Bool -> Qualification -> ExportItem DocName-                       -> [Html]-processForMiniSynopsis mdl unicode qual ExportDecl { expItemDecl = L _loc decl0 } =-  ((divTopDecl <<).(declElem <<)) <$> case decl0 of-    TyClD d -> let b = ppTyClBinderWithVarsMini mdl d in case d of-        (FamDecl decl)    -> [ppTyFamHeader True False decl unicode qual]-        (DataDecl{})   -> [keyword "data" <+> b]-        (SynDecl{})    -> [keyword "type" <+> b]-        (ClassDecl {}) -> [keyword "class" <+> b]-    SigD (TypeSig lnames _) ->-      map (ppNameMini Prefix mdl . nameOccName . getName . unLoc) lnames-    _ -> []-processForMiniSynopsis _ _ qual (ExportGroup lvl _id txt) =-  [groupTag lvl << docToHtml Nothing qual (mkMeta txt)]-processForMiniSynopsis _ _ _ _ = []---ppNameMini :: Notation -> Module -> OccName -> Html-ppNameMini notation mdl nm =-    anchor ! [ href (moduleNameUrl mdl nm)-             , target mainFrameName ]-      << ppBinder' notation nm---ppTyClBinderWithVarsMini :: Module -> TyClDecl DocName -> Html-ppTyClBinderWithVarsMini mdl decl =-  let n = tcdName decl-      ns = tyvarNames $ tcdTyVars decl -- it's safe to use tcdTyVars, see code above-  in ppTypeApp n [] ns (\is_infix -> ppNameMini is_infix mdl . nameOccName . getName) ppTyName- ppModuleContents :: Qualification                  -> [ExportItem DocName]                  -> Bool -- ^ Orphans sections@@ -632,8 +604,8 @@ processExport _ _ _ _ ExportDecl { expItemDecl = L _ (InstD _) } = Nothing -- Hide empty instances processExport summary _ _ qual (ExportGroup lev id0 doc)   = nothingIf summary $ groupHeading lev id0 << docToHtml (Just id0) qual (mkMeta doc)-processExport summary links unicode qual (ExportDecl decl doc subdocs insts fixities splice)-  = processDecl summary $ ppDecl summary links decl doc insts fixities subdocs splice unicode qual+processExport summary links unicode qual (ExportDecl decl pats doc subdocs insts fixities splice)+  = processDecl summary $ ppDecl summary links decl pats doc insts fixities subdocs splice unicode qual processExport summary _ _ qual (ExportNoDecl y [])   = processDeclOneLiner summary $ ppDocName qual Prefix True y processExport summary _ _ qual (ExportNoDecl y subs)
haddock-api/src/Haddock/Backends/Xhtml/Decl.hs view
@@ -34,27 +34,29 @@ import           Data.Maybe import           Text.XHtml hiding     ( name, title, p, quote ) -import GHC+import GHC hiding (LexicalFixity(..)) import GHC.Exts import Name import BooleanFormula import RdrName ( rdrNameOcc )  ppDecl :: Bool -> LinksInfo -> LHsDecl DocName-       -> DocForDecl DocName -> [DocInstance DocName] -> [(DocName, Fixity)]+       -> [(HsDecl DocName, DocForDecl DocName)]+       -> DocForDecl DocName ->  [DocInstance DocName] -> [(DocName, Fixity)]        -> [(DocName, DocForDecl DocName)] -> Splice -> Unicode -> Qualification -> Html-ppDecl summ links (L loc decl) (mbDoc, fnArgsDoc) instances fixities subdocs splice unicode qual = case decl of-  TyClD (FamDecl d)         -> ppTyFam summ False links instances fixities loc mbDoc d splice unicode qual-  TyClD d@(DataDecl {})     -> ppDataDecl summ links instances fixities subdocs loc mbDoc d splice unicode qual-  TyClD d@(SynDecl {})      -> ppTySyn summ links fixities loc (mbDoc, fnArgsDoc) d splice unicode qual-  TyClD d@(ClassDecl {})    -> ppClassDecl summ links instances fixities loc mbDoc subdocs d splice unicode qual-  SigD (TypeSig lnames lty) -> ppLFunSig summ links loc (mbDoc, fnArgsDoc) lnames+ppDecl summ links (L loc decl) pats (mbDoc, fnArgsDoc) instances fixities subdocs splice unicode qual = case decl of+  TyClD (FamDecl d)            -> ppTyFam summ False links instances fixities loc mbDoc d splice unicode qual+  TyClD d@(DataDecl {})        -> ppDataDecl summ links instances fixities subdocs loc mbDoc d pats splice unicode qual+  TyClD d@(SynDecl {})         -> ppTySyn summ links fixities loc (mbDoc, fnArgsDoc) d splice unicode qual+  TyClD d@(ClassDecl {})       -> ppClassDecl summ links instances fixities loc mbDoc subdocs d splice unicode qual+  SigD (TypeSig lnames lty)    -> ppLFunSig summ links loc (mbDoc, fnArgsDoc) lnames                                          (hsSigWcType lty) fixities splice unicode qual-  SigD (PatSynSig lname ty) -> ppLPatSig summ links loc (mbDoc, fnArgsDoc) lname+  SigD (PatSynSig lnames ty)   -> ppLPatSig summ links loc (mbDoc, fnArgsDoc) lnames                                          ty fixities splice unicode qual-  ForD d                         -> ppFor summ links loc (mbDoc, fnArgsDoc) d fixities splice unicode qual-  InstD _                        -> noHtml-  _                              -> error "declaration not supported by ppDecl"+  ForD d                       -> ppFor summ links loc (mbDoc, fnArgsDoc) d fixities splice unicode qual+  InstD _                      -> noHtml+  DerivD _                     -> noHtml+  _                            -> error "declaration not supported by ppDecl"   ppLFunSig :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName ->@@ -74,22 +76,20 @@     pp_typ = ppLType unicode qual typ  ppLPatSig :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName ->-             Located DocName -> LHsSigType DocName ->+             [Located DocName] -> LHsSigType DocName ->              [(DocName, Fixity)] ->              Splice -> Unicode -> Qualification -> Html-ppLPatSig summary links loc (doc, _argDocs) (L _ name) typ fixities splice unicode qual+ppLPatSig summary links loc (doc, _argDocs) docnames typ fixities splice unicode qual   | summary = pref1-  | otherwise = topDeclElem links loc splice [name] (pref1 <+> ppFixities fixities qual)+  | otherwise = topDeclElem links loc splice (map unLoc docnames) (pref1 <+> ppFixities fixities qual)                 +++ docSection Nothing qual doc   where     pref1 = hsep [ keyword "pattern"-                 , ppBinder summary occname+                 , hsep $ punctuate comma $ map (ppBinder summary . getOccName) docnames                  , dcolon unicode                  , ppLType unicode qual (hsSigType typ)                  ] -    occname = nameOccName . getName $ name- ppSigLike :: Bool -> LinksInfo -> SrcSpan -> Html -> DocForDecl DocName ->              [DocName] -> [(DocName, Fixity)] -> (HsType DocName, Html) ->              Splice -> Unicode -> Qualification -> Html@@ -172,8 +172,8 @@   -- | Pretty-print type variables.-ppTyVars :: [LHsTyVarBndr DocName] -> [Html]-ppTyVars tvs = map (ppTyName . getName . hsLTyVarName) tvs+ppTyVars :: Unicode -> Qualification -> [LHsTyVarBndr DocName] -> [Html]+ppTyVars unicode qual tvs = map (ppHsTyVarBndr unicode qual . unLoc) tvs  tyvarNames :: LHsQTyVars DocName -> [Name] tyvarNames = map (getName . hsLTyVarName) . hsQTvExplicit@@ -200,7 +200,7 @@                    splice unicode qual   where     hdr  = hsep ([keyword "type", ppBinder summary occ]-                 ++ ppTyVars (hsQTvExplicit ltyvars))+                 ++ ppTyVars unicode qual (hsQTvExplicit ltyvars))     full = hdr <+> equals <+> ppLType unicode qual ltype     occ  = nameOccName . getName $ name     fixs@@ -354,20 +354,20 @@ -- | Print a type family and its variables ppFamDeclBinderWithVars :: Bool -> Unicode -> Qualification -> FamilyDecl DocName -> Html ppFamDeclBinderWithVars summ unicode qual (FamilyDecl { fdLName = lname, fdTyVars = tvs }) =-  ppAppDocNameTyVarBndrs summ unicode qual (unLoc lname) (map unLoc $ hsq_explicit tvs)+  ppAppDocNameTyVarBndrs summ unicode qual (unLoc lname) (hsq_explicit tvs)  -- | Print a newtype / data binder and its variables-ppDataBinderWithVars :: Bool -> TyClDecl DocName -> Html-ppDataBinderWithVars summ decl =-  ppAppDocNameNames summ (tcdName decl) (tyvarNames $ tcdTyVars decl)+ppDataBinderWithVars :: Bool -> Unicode -> Qualification -> TyClDecl DocName -> Html+ppDataBinderWithVars summ unicode qual decl =+  ppAppDocNameTyVarBndrs summ unicode qual (tcdName decl) (hsQTvExplicit $ tcdTyVars decl)  -------------------------------------------------------------------------------- -- * Type applications -------------------------------------------------------------------------------- -ppAppDocNameTyVarBndrs :: Bool -> Unicode -> Qualification -> DocName -> [HsTyVarBndr DocName] -> Html+ppAppDocNameTyVarBndrs :: Bool -> Unicode -> Qualification -> DocName -> [LHsTyVarBndr DocName] -> Html ppAppDocNameTyVarBndrs summ unicode qual n vs =-    ppTypeApp n [] vs ppDN (ppHsTyVarBndr unicode qual)+    ppTypeApp n [] vs ppDN (ppHsTyVarBndr unicode qual . unLoc)   where     ppDN notation = ppBinderFixity notation summ . nameOccName . getName     ppBinderFixity Infix = ppBinderInfix@@ -380,15 +380,6 @@     ppTypeApp n ks ts (\p -> ppDocName qual p True) (ppParendType unicode qual)  --- | Print an application of a 'DocName' and a list of 'Names'-ppAppDocNameNames :: Bool -> DocName -> [Name] -> Html-ppAppDocNameNames summ n ns =-    ppTypeApp n [] ns ppDN ppTyName-  where-    ppDN notation = ppBinderFixity notation summ . nameOccName . getName-    ppBinderFixity Infix = ppBinderInfix-    ppBinderFixity _ = ppBinder- -- | General printing of type applications ppTypeApp :: DocName -> [a] -> [a] -> (Notation -> DocName -> Html) -> (a -> Html) -> Html ppTypeApp n [] (t1:t2:rest) ppDN ppT@@ -446,7 +437,7 @@ ppClassHdr summ lctxt n tvs fds unicode qual =   keyword "class"   <+> (if not . null . unLoc $ lctxt then ppLContext lctxt unicode qual else noHtml)-  <+> ppAppDocNameNames summ n (tyvarNames tvs)+  <+> ppAppDocNameTyVarBndrs summ unicode qual n (hsQTvExplicit tvs)   <+> ppFds fds unicode qual  @@ -530,9 +521,8 @@                                                , f@(n',_) <- fixities                                                , n == n' ]                                  names = map unLoc lnames ]-                           -- FIXME: is taking just the first name ok? Is it possible that-                           -- there are different subdocs for different names in a single-                           -- type signature?+                           -- N.B. taking just the first name is ok. Signatures with multiple names+                           -- are expanded so that each name gets its own signature.      minimalBit = case [ s | MinimalSig _ (L _ s) <- sigs ] of       -- Miminal complete definition = every shown method@@ -624,7 +614,7 @@             , [subFamInstDetails iid pdecl])           where             pdata = keyword "data" <+> typ-            pdecl = pdata <+> ppShortDataDecl False True dd unicode qual+            pdecl = pdata <+> ppShortDataDecl False True dd [] unicode qual   where     iid = instanceId origin no orphan ihd     typ = ppAppNameTypes ihdClsName ihdKinds ihdTypes unicode qual@@ -645,10 +635,10 @@ ppInstanceSigs links splice unicode qual sigs = do     TypeSig lnames typ <- sigs     let names = map unLoc lnames-        L loc rtyp = get_type typ-    return $ ppSimpleSig links splice unicode qual loc names rtyp-    where-      get_type = hswc_body . hsib_body+        L _ rtyp = hsSigWcType typ+    -- Instance methods signatures are synified and thus don't have a useful +    -- SrcSpan value. Use the methods name location instead.+    return $ ppSimpleSig links splice unicode qual (getLoc $ head $ lnames) names rtyp   lookupAnySubdoc :: Eq id1 => id1 -> [(id1, DocForDecl id2)] -> DocForDecl id2@@ -675,20 +665,23 @@   -- TODO: print contexts-ppShortDataDecl :: Bool -> Bool -> TyClDecl DocName -> Unicode -> Qualification -> Html-ppShortDataDecl summary dataInst dataDecl unicode qual+ppShortDataDecl :: Bool -> Bool -> TyClDecl DocName+                -> [(HsDecl DocName,DocForDecl DocName)]+                -> Unicode -> Qualification -> Html+ppShortDataDecl summary dataInst dataDecl pats unicode qual -  | [] <- cons = dataHeader+  | [] <- cons+  , [] <- pats = dataHeader -  | [lcon] <- cons, isH98,+  | [lcon] <- cons, [] <- pats, isH98,     (cHead,cBody,cFoot) <- ppShortConstrParts summary dataInst (unLoc lcon) unicode qual        = (dataHeader <+> equals <+> cHead) +++ cBody +++ cFoot -  | isH98 = dataHeader-      +++ shortSubDecls dataInst (zipWith doConstr ('=':repeat '|') cons)+  | [] <- pats, isH98 = dataHeader+      +++ shortSubDecls dataInst (zipWith doConstr ('=':repeat '|') cons ++ pats1)    | otherwise = (dataHeader <+> keyword "where")-      +++ shortSubDecls dataInst (map doGADTConstr cons)+      +++ shortSubDecls dataInst (map doGADTConstr cons ++ pats1)    where     dataHeader@@ -702,16 +695,25 @@                   ConDeclH98 {} -> True                   ConDeclGADT{} -> False +    pats1 = [ hsep [ keyword "pattern"+                   , hsep $ punctuate comma $ map (ppBinder summary . getOccName) lnames+                   , dcolon unicode+                   , ppLType unicode qual (hsSigType typ)+                   ]+            | (SigD (PatSynSig lnames typ),_) <- pats+            ] + ppDataDecl :: Bool -> LinksInfo -> [DocInstance DocName] -> [(DocName, Fixity)] ->               [(DocName, DocForDecl DocName)] ->               SrcSpan -> Documentation DocName -> TyClDecl DocName ->+              [(HsDecl DocName,DocForDecl DocName)] ->               Splice -> Unicode -> Qualification -> Html-ppDataDecl summary links instances fixities subdocs loc doc dataDecl+ppDataDecl summary links instances fixities subdocs loc doc dataDecl pats            splice unicode qual -  | summary   = ppShortDataDecl summary False dataDecl unicode qual-  | otherwise = header_ +++ docSection Nothing qual doc +++ constrBit +++ instancesBit+  | summary   = ppShortDataDecl summary False dataDecl pats unicode qual+  | otherwise = header_ +++ docSection Nothing qual doc +++ constrBit +++ patternBit +++ instancesBit    where     docname   = tcdName dataDecl@@ -726,7 +728,9 @@     fix = ppFixities (filter (\(n,_) -> n == docname) fixities) qual      whereBit-      | null cons = noHtml+      | null cons+      , null pats = noHtml+      | null cons = keyword "where"       | otherwise = if isH98 then noHtml else keyword "where"      constrBit = subConstructors qual@@ -736,6 +740,17 @@                                      (map unLoc (getConNames (unLoc c)))) fixities       ] +    patternBit = subPatterns qual+      [ (hsep [ keyword "pattern"+              , hsep $ punctuate comma $ map (ppBinder summary . getOccName) lnames+              , dcolon unicode+              , ppLType unicode qual (hsSigType typ)+              ] <+> ppFixities subfixs qual+        ,combineDocumentation (fst d), [])+      | (SigD (PatSynSig lnames typ),d) <- pats+      , let subfixs = filter (\(n,_) -> any (\cn -> cn == n) (map unLoc lnames)) fixities+      ]+     instancesBit = ppInstances links (OriginData docname) instances         splice unicode qual @@ -893,7 +908,7 @@     -- context     ppLContext ctxt unicode qual <+>     -- T a b c ..., or a :+: b-    ppDataBinderWithVars summary decl+    ppDataBinderWithVars summary unicode qual decl     <+> case ks of       Nothing -> mempty       Just (L _ x) -> dcolon unicode <+> ppKind unicode qual x@@ -916,6 +931,9 @@ tupleParens _              = parenList  +sumParens :: [Html] -> Html+sumParens = ubxSumList+ -------------------------------------------------------------------------------- -- * Rendering of HsType --------------------------------------------------------------------------------@@ -967,8 +985,8 @@ ppKind :: Unicode -> Qualification -> HsKind DocName -> Html ppKind unicode qual ki = ppr_mono_ty pREC_TOP ki unicode qual -ppForAllPart :: [LHsTyVarBndr DocName] -> Unicode -> Html-ppForAllPart tvs unicode = hsep (forallSymbol unicode : ppTyVars tvs) +++ dot+ppForAllPart :: Unicode -> Qualification -> [LHsTyVarBndr DocName] -> Html+ppForAllPart unicode qual tvs = hsep (forallSymbol unicode : ppTyVars unicode qual tvs) +++ dot  ppr_mono_lty :: Int -> LHsType DocName -> Unicode -> Qualification -> Html ppr_mono_lty ctxt_prec ty = ppr_mono_ty ctxt_prec (unLoc ty)@@ -977,26 +995,27 @@ ppr_mono_ty :: Int -> HsType DocName -> Unicode -> Qualification -> Html ppr_mono_ty ctxt_prec (HsForAllTy tvs ty) unicode qual   = maybeParen ctxt_prec pREC_FUN $-    ppForAllPart tvs unicode <+> ppr_mono_lty pREC_TOP ty unicode qual+    ppForAllPart unicode qual tvs <+> ppr_mono_lty pREC_TOP ty unicode qual  ppr_mono_ty ctxt_prec (HsQualTy ctxt ty) unicode qual   = maybeParen ctxt_prec pREC_FUN $     ppLContext ctxt unicode qual <+> ppr_mono_lty pREC_TOP ty unicode qual  -- UnicodeSyntax alternatives-ppr_mono_ty _ (HsTyVar (L _ name)) True _+ppr_mono_ty _ (HsTyVar _ (L _ name)) True _   | getOccString (getName name) == "*"    = toHtml "★"   | getOccString (getName name) == "(->)" = toHtml "(→)"  ppr_mono_ty _         (HsBangTy b ty)     u q = ppBang b +++ ppLParendType u q ty-ppr_mono_ty _         (HsTyVar (L _ name)) _ q = ppDocName q Prefix True name+ppr_mono_ty _         (HsTyVar _ (L _ name)) _ q = ppDocName q Prefix True name ppr_mono_ty ctxt_prec (HsFunTy ty1 ty2)   u q = ppr_fun_ty ctxt_prec ty1 ty2 u q ppr_mono_ty _         (HsTupleTy con tys) u q = tupleParens con (map (ppLType u q) tys)+ppr_mono_ty _         (HsSumTy tys) u q = sumParens (map (ppLType u q) tys) ppr_mono_ty _         (HsKindSig ty kind) u q =     parens (ppr_mono_lty pREC_TOP ty u q <+> dcolon u <+> ppLKind u q kind) ppr_mono_ty _         (HsListTy ty)       u q = brackets (ppr_mono_lty pREC_TOP ty u q) ppr_mono_ty _         (HsPArrTy ty)       u q = pabrackets (ppr_mono_lty pREC_TOP ty u q)-ppr_mono_ty ctxt_prec (HsIParamTy n ty)   u q =+ppr_mono_ty ctxt_prec (HsIParamTy (L _ n) ty) u q =     maybeParen ctxt_prec pREC_CTX $ ppIPName n <+> dcolon u <+> ppr_mono_lty pREC_TOP ty u q ppr_mono_ty _         (HsSpliceTy {})     _ _ = error "ppr_mono_ty HsSpliceTy" ppr_mono_ty _         (HsRecTy {})        _ _ = toHtml "{..}"@@ -1004,7 +1023,8 @@        -- placeholder in the signature, which is followed by the field        -- declarations. ppr_mono_ty _         (HsCoreTy {})       _ _ = error "ppr_mono_ty HsCoreTy"-ppr_mono_ty _         (HsExplicitListTy _ tys) u q = promoQuote $ brackets $ hsep $ punctuate comma $ map (ppLType u q) tys+ppr_mono_ty _         (HsExplicitListTy Promoted _ tys) u q = promoQuote $ brackets $ hsep $ punctuate comma $ map (ppLType u q) tys+ppr_mono_ty _         (HsExplicitListTy NotPromoted _ tys) u q = brackets $ hsep $ punctuate comma $ map (ppLType u q) tys ppr_mono_ty _         (HsExplicitTupleTy _ tys) u q = promoQuote $ parenList $ map (ppLType u q) tys ppr_mono_ty _         (HsAppsTy {})       _ _ = error "ppr_mono_ty HsAppsTy" 
haddock-api/src/Haddock/Backends/Xhtml/Layout.hs view
@@ -29,6 +29,7 @@   subArguments,   subAssociatedTypes,   subConstructors,+  subPatterns,   subEquations,   subFields,   subInstances, subOrphanInstances,@@ -179,6 +180,9 @@  subConstructors :: Qualification -> [SubDecl] -> Html subConstructors qual = divSubDecls "constructors" "Constructors" . subTable qual++subPatterns :: Qualification -> [SubDecl] -> Html+subPatterns qual = divSubDecls "bundled-patterns" "Bundled Patterns" . subTable qual  subFields :: Qualification -> [SubDecl] -> Html subFields qual = divSubDecls "fields" "Fields" . subDlist qual
haddock-api/src/Haddock/Backends/Xhtml/Names.hs view
@@ -26,7 +26,7 @@ import qualified Data.Map as M import qualified Data.List as List -import GHC+import GHC hiding (LexicalFixity(..)) import Name import RdrName import FastString (unpackFS)
haddock-api/src/Haddock/Backends/Xhtml/Utils.hs view
@@ -20,7 +20,7 @@   (<+>), (<=>), char,   keyword, punctuate, -  braces, brackets, pabrackets, parens, parenList, ubxParenList,+  braces, brackets, pabrackets, parens, parenList, ubxParenList, ubxSumList,   arrow, comma, dcolon, dot, darrow, equals, forallSymbol, quote, promoQuote,    hsep, vcat,@@ -175,6 +175,10 @@  ubxParenList :: [Html] -> Html ubxParenList = ubxparens . hsep . punctuate comma+++ubxSumList :: [Html]  -> Html+ubxSumList = ubxparens . hsep . punctuate (toHtml " | ")   ubxparens :: Html -> Html
haddock-api/src/Haddock/Convert.hs view
@@ -1,4 +1,3 @@- {-# LANGUAGE CPP, PatternGuards #-} ----------------------------------------------------------------------------- -- |@@ -18,7 +17,7 @@ -- instance heads, which aren't TyThings, so just export everything.  import Bag ( emptyBag )-import BasicTypes ( TupleSort(..) )+import BasicTypes ( TupleSort(..), SourceText(..), LexicalFixity(..) ) import Class import CoAxiom import ConLike@@ -30,15 +29,15 @@ import NameSet ( emptyNameSet ) import RdrName ( mkVarUnqual ) import PatSyn-import SrcLoc ( Located, noLoc, unLoc )+import SrcLoc ( Located, noLoc, unLoc, GenLocated(..), srcLocSpan ) import TcType ( tcSplitSigmaTy ) import TyCon import Type import TyCoRep-import TysPrim ( alphaTyVars, unliftedTypeKindTyConName )+import TysPrim ( alphaTyVars ) import TysWiredIn ( listTyConName, starKindTyConName, unitTy ) import PrelNames ( hasKey, eqTyConKey, ipClassKey-                 , tYPETyConKey, ptrRepLiftedDataConKey, ptrRepUnliftedDataConKey )+                 , tYPETyConKey, liftedRepDataConKey ) import Unique ( getUnique ) import Util ( filterByList, filterOut ) import Var@@ -78,10 +77,11 @@          { tcdCtxt = synifyCtx (classSCTheta cl)          , tcdLName = synifyName cl          , tcdTyVars = synifyTyVars (classTyVars cl)+         , tcdFixity = Prefix          , tcdFDs = map (\ (l,r) -> noLoc                         (map (noLoc . getName) l, map (noLoc . getName) r) ) $                          snd $ classTvsFds cl-         , tcdSigs = noLoc (MinimalSig mempty . noLoc . fmap noLoc $ classMinimalDef cl) :+         , tcdSigs = noLoc (MinimalSig NoSourceText . noLoc . fmap noLoc $ classMinimalDef cl) :                       map (noLoc . synifyTcIdSig DeleteTopLevelQuantification)                         (classMethods cl)          , tcdMeths = emptyBag --ignore default method definitions, they don't affect signature@@ -102,7 +102,7 @@     (synifySigWcType ImplicitizeForAll (dataConUserType dc)))    AConLike (PatSynCon ps) ->-    allOK . SigD $ PatSynSig (synifyName ps) (synifyPatSynSigType ps)+    allOK . SigD $ PatSynSig [synifyName ps] (synifyPatSynSigType ps)   where     withErrs e x = return (e, x)     allOK x = return (mempty, x)@@ -114,7 +114,9 @@         hs_rhs     = synifyType WithinType rhs     in TyFamEqn { tfe_tycon = name                 , tfe_pats  = HsIB { hsib_body = typats-                                   , hsib_vars = map tyVarName tkvs }+                                   , hsib_vars = map tyVarName tkvs+                                   , hsib_closed = True }+                , tfe_fixity = Prefix                 , tfe_rhs   = hs_rhs }  synifyAxiom :: CoAxiom br -> Either ErrMsg (HsDecl Name)@@ -147,6 +149,8 @@                                                                 alphaTyVars --a, b, c... which are unfortunately all kind *                                    , hsq_dependent = emptyNameSet } +           , tcdFixity = Prefix+            , tcdDataDefn = HsDataDefn { dd_ND = DataType  -- arbitrary lie, they are neither                                                     -- algebraic data nor newtype:                                       , dd_ctxt = noLoc []@@ -154,7 +158,7 @@                                       , dd_kindSig = Just (synifyKindSig (tyConKind tc))                                                -- we have their kind accurately:                                       , dd_cons = []  -- No constructors-                                      , dd_derivs = Nothing }+                                      , dd_derivs = noLoc [] }            , tcdDataCusk = False            , tcdFVs = placeHolderNamesTc } @@ -181,6 +185,7 @@       FamilyDecl { fdInfo = i                  , fdLName = synifyName tc                  , fdTyVars = synifyTyVars (tyConTyVars tc)+                 , fdFixity = Prefix                  , fdResultSig =                        synifyFamilyResultSig resultVar (tyConResKind tc)                  , fdInjectivityAnn =@@ -192,6 +197,7 @@   | Just ty <- synTyConRhs_maybe tc   = return $ SynDecl { tcdLName = synifyName tc                      , tcdTyVars = synifyTyVars (tyConTyVars tc)+                     , tcdFixity = Prefix                      , tcdRhs = synifyType WithinType ty                      , tcdFVs = placeHolderNamesTc }   | otherwise =@@ -225,7 +231,7 @@   consRaw = map (synifyDataCon use_gadt_syntax) (tyConDataCons tc)   cons = rights consRaw   -- "deriving" doesn't affect the signature, no need to specify any.-  alg_deriv = Nothing+  alg_deriv = noLoc []   defn = HsDataDefn { dd_ND      = alg_nd                     , dd_ctxt    = alg_ctx                     , dd_cType   = Nothing@@ -234,7 +240,8 @@                     , dd_derivs  = alg_deriv }  in case lefts consRaw of   [] -> return $-        DataDecl { tcdLName = name, tcdTyVars = tyvars, tcdDataDefn = defn+        DataDecl { tcdLName = name, tcdTyVars = tyvars, tcdFixity = Prefix+                 , tcdDataDefn = defn                  , tcdDataCusk = False, tcdFVs = placeHolderNamesTc }   dataConErrs -> Left $ unlines dataConErrs @@ -294,7 +301,7 @@           (False,True) -> case linear_tys of                            [a,b] -> return $ InfixCon a b                            _ -> Left "synifyDataCon: infix with non-2 args?"-  gadt_ty = HsIB [] (synifyType WithinType res_ty)+  gadt_ty = HsIB [] (synifyType WithinType res_ty) False  -- finally we get synifyDataCon's result!  in hs_arg_tys >>=       \hat ->@@ -311,7 +318,7 @@                          , con_doc =  Nothing }  synifyName :: NamedThing n => n -> Located Name-synifyName = noLoc . getName+synifyName n = L (srcLocSpan (getSrcLoc n)) (getName n)   synifyIdSig :: SynifyTypeState -> Id -> Sig Name@@ -360,24 +367,20 @@  synifySigWcType :: SynifyTypeState -> Type -> LHsSigWcType Name -- Ditto (see synifySigType)-synifySigWcType s ty = mkEmptyImplicitBndrs (mkEmptyWildCardBndrs (synifyType s ty))+synifySigWcType s ty = mkEmptyWildCardBndrs (mkEmptyImplicitBndrs (synifyType s ty))  synifyPatSynSigType :: PatSyn -> LHsSigType Name -- Ditto (see synifySigType) synifyPatSynSigType ps = mkEmptyImplicitBndrs (synifyPatSynType ps)  synifyType :: SynifyTypeState -> Type -> LHsType Name-synifyType _ (TyVarTy tv) = noLoc $ HsTyVar $ noLoc (getName tv)+synifyType _ (TyVarTy tv) = noLoc $ HsTyVar NotPromoted $ noLoc (getName tv) synifyType _ (TyConApp tc tys)   -- Use */# instead of TYPE 'Lifted/TYPE 'Unlifted (#473)   | tc `hasKey` tYPETyConKey   , [TyConApp lev []] <- tys-  , lev `hasKey` ptrRepLiftedDataConKey-  = noLoc (HsTyVar (noLoc starKindTyConName))-  | tc `hasKey` tYPETyConKey-  , [TyConApp lev []] <- tys-  , lev `hasKey` ptrRepUnliftedDataConKey-  = noLoc (HsTyVar (noLoc unliftedTypeKindTyConName))+  , lev `hasKey` liftedRepDataConKey+  = noLoc (HsTyVar NotPromoted (noLoc starKindTyConName))   -- Use non-prefix tuple syntax where possible, because it looks nicer.   | Just sort <- tyConTuple_maybe tc   , tyConArity tc == length tys@@ -393,7 +396,7 @@   | tc `hasKey` ipClassKey   , [name, ty] <- tys   , Just x <- isStrLitTy name-  = noLoc $ HsIParamTy (HsIPName x) (synifyType WithinType ty)+  = noLoc $ HsIParamTy (noLoc $ HsIPName x) (synifyType WithinType ty)   -- and equalities   | tc `hasKey` eqTyConKey   , [ty1, ty2] <- tys@@ -401,7 +404,7 @@   -- Most TyCons:   | otherwise =     foldl (\t1 t2 -> noLoc (HsAppTy t1 t2))-      (noLoc $ HsTyVar $ noLoc (getName tc))+      (noLoc $ HsTyVar NotPromoted $ noLoc (getName tc))       (map (synifyType WithinType) $        filterOut isCoercionTy tys) synifyType s (AppTy t1 (CoercionTy {})) = synifyType s t1@@ -409,7 +412,7 @@   s1 = synifyType WithinType t1   s2 = synifyType WithinType t2   in noLoc $ HsAppTy s1 s2-synifyType _ (ForAllTy (Anon t1) t2) = let+synifyType _ (FunTy t1 t2) = let   s1 = synifyType WithinType t1   s2 = synifyType WithinType t2   in noLoc $ HsFunTy s1 s2@@ -444,8 +447,8 @@   in noLoc $ sForAll univ_tvs $ sQual req_theta' $ sForAll ex_tvs $ sQual prov_theta sTau  synifyTyLit :: TyLit -> HsTyLit-synifyTyLit (NumTyLit n) = HsNumTy mempty n-synifyTyLit (StrTyLit s) = HsStrTy mempty s+synifyTyLit (NumTyLit n) = HsNumTy NoSourceText n+synifyTyLit (StrTyLit s) = HsStrTy NoSourceText s  synifyKindSig :: Kind -> LHsKind Name synifyKindSig k = synifyType WithinType k
haddock-api/src/Haddock/GhcUtils.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE FlexibleInstances, ViewPatterns #-}+{-# LANGUAGE BangPatterns, FlexibleInstances, ViewPatterns #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_HADDOCK hide #-} -----------------------------------------------------------------------------@@ -17,17 +17,14 @@   import Control.Arrow-import Data.Function  import Exception import Outputable import Name+import NameSet import Lexeme import Module-import RdrName (GlobalRdrEnv)-import GhcMonad (withSession) import HscTypes-import UniqFM import GHC import Class @@ -92,6 +89,10 @@   case filter (p . unLoc) ns of     []       -> Nothing     filtered -> Just (ClassOpSig is_default filtered ty)+filterSigNames p (PatSynSig ns ty) =+  case filter (p . unLoc) ns of+    []       -> Nothing+    filtered -> Just (PatSynSig filtered ty) filterSigNames _ _                           = Nothing  ifTrueJust :: Bool -> name -> Maybe name@@ -104,7 +105,7 @@ sigNameNoLoc :: Sig name -> [name] sigNameNoLoc (TypeSig      ns _)       = map unLoc ns sigNameNoLoc (ClassOpSig _ ns _)       = map unLoc ns-sigNameNoLoc (PatSynSig    n _)        = [unLoc n]+sigNameNoLoc (PatSynSig    ns _)       = map unLoc ns sigNameNoLoc (SpecSig      n _ _)      = [unLoc n] sigNameNoLoc (InlineSig    n _)        = [unLoc n] sigNameNoLoc (FixSig (FixitySig ns _)) = map unLoc ns@@ -114,6 +115,7 @@ isUserLSig :: LSig name -> Bool isUserLSig (L _(TypeSig {}))    = True isUserLSig (L _(ClassOpSig {})) = True+isUserLSig (L _(PatSynSig {}))  = True isUserLSig _                    = False  @@ -133,6 +135,17 @@  pretty :: Outputable a => DynFlags -> a -> String pretty = showPpr++nubByName :: (a -> Name) -> [a] -> [a]+nubByName f ns = go emptyNameSet ns+  where+    go !_ [] = []+    go !s (x:xs)+      | y `elemNameSet` s = go s xs+      | otherwise         = let !s' = extendNameSet s y+                            in x : go s' xs+      where+        y = f x  ------------------------------------------------------------------------------- -- * Located
haddock-api/src/Haddock/Interface.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- Module      :  Haddock.Interface@@ -56,7 +57,14 @@ import GHC hiding (verbosity) import HscTypes import FastString (unpackFS)+import MonadUtils (liftIO) +#if defined(mingw32_HOST_OS)+import System.IO+import GHC.IO.Encoding.CodePage (mkLocaleEncoding)+import GHC.IO.Encoding.Failure (CodingFailureMode(TransliterateCodingFailure))+#endif+ -- | Create 'Interface's and a link environment by typechecking the list of -- modules using the GHC API and processing the resulting syntax trees. processModules@@ -68,6 +76,10 @@   -> Ghc ([Interface], LinkEnv) -- ^ Resulting list of interfaces and renaming                                 -- environment processModules verbosity modules flags extIfaces = do+#if defined(mingw32_HOST_OS)+  -- Avoid internal error: <stderr>: hPutChar: invalid argument (invalid character)' non UTF-8 Windows+  liftIO $ hSetEncoding stderr $ mkLocaleEncoding TransliterateCodingFailure+#endif    out verbosity verbose "Creating interfaces..."   let instIfaceMap =  Map.fromList [ (instMod iface, iface) | ext <- extIfaces
haddock-api/src/Haddock/Interface/AttachInstances.hs view
@@ -18,11 +18,11 @@ import Haddock.Convert import Haddock.GhcUtils +import Control.Applicative import Control.Arrow hiding ((<+>)) import Data.List import Data.Ord (comparing)-import Data.Function (on)-import Data.Maybe ( maybeToList, mapMaybe )+import Data.Maybe ( maybeToList, mapMaybe, fromMaybe ) import qualified Data.Map as Map import qualified Data.Set as Set @@ -33,14 +33,13 @@ import FamInstEnv import FastString import GHC-import GhcMonad (withSession) import InstEnv import MonadUtils (liftIO) import Name+import NameEnv import Outputable (text, sep, (<+>)) import PrelNames import SrcLoc-import TcRnDriver (tcRnGetInfo) import TyCon import TyCoRep import TysPrim( funTyCon )@@ -53,13 +52,15 @@  -- Also attaches fixities attachInstances :: ExportInfo -> [Interface] -> InstIfaceMap -> Ghc [Interface]-attachInstances expInfo ifaces instIfaceMap = mapM attach ifaces+attachInstances expInfo ifaces instIfaceMap = do+  (_msgs, mb_index) <- getNameToInstancesIndex+  mapM (attach $ fromMaybe emptyNameEnv mb_index) ifaces   where     -- TODO: take an IfaceMap as input     ifaceMap = Map.fromList [ (ifaceMod i, i) | i <- ifaces ] -    attach iface = do-      newItems <- mapM (attachToExportItem expInfo iface ifaceMap instIfaceMap)+    attach index iface = do+      newItems <- mapM (attachToExportItem index expInfo iface ifaceMap instIfaceMap)                        (ifaceExportItems iface)       let orphanInstances = attachOrphanInstances expInfo iface ifaceMap instIfaceMap (ifaceInstances iface)       return $ iface { ifaceExportItems = newItems@@ -75,47 +76,56 @@   ]  -attachToExportItem :: ExportInfo -> Interface -> IfaceMap -> InstIfaceMap-                   -> ExportItem Name-                   -> Ghc (ExportItem Name)-attachToExportItem expInfo iface ifaceMap instIfaceMap export =+attachToExportItem+  :: NameEnv ([ClsInst], [FamInst])+  -> ExportInfo+  -> Interface+  -> IfaceMap+  -> InstIfaceMap+  -> ExportItem Name+  -> Ghc (ExportItem Name)+attachToExportItem index expInfo iface ifaceMap instIfaceMap export =   case attachFixities export of     e@ExportDecl { expItemDecl = L eSpan (TyClD d) } -> do-      mb_info <- getAllInfo (tcdName d)-      insts <- case mb_info of-        Just (_, _, cls_instances, fam_instances) ->-          let fam_insts = [ (synifyFamInst i opaque, doc,spanNameE n (synifyFamInst i opaque) (L eSpan (tcdName d)) )-                          | i <- sortBy (comparing instFam) fam_instances-                          , let n = getName i-                          , let doc = instLookup instDocMap n iface ifaceMap instIfaceMap-                          , not $ isNameHidden expInfo (fi_fam i)-                          , not $ any (isTypeHidden expInfo) (fi_tys i)-                          , let opaque = isTypeHidden expInfo (fi_rhs i)-                          ]-              cls_insts = [ (synifyInstHead i, instLookup instDocMap n iface ifaceMap instIfaceMap, spanName n (synifyInstHead i) (L eSpan (tcdName d)))-                          | let is = [ (instanceSig i, getName i) | i <- cls_instances ]-                          , (i@(_,_,cls,tys), n) <- sortBy (comparing $ first instHead) is-                          , not $ isInstanceHidden expInfo cls tys-                          ]+      insts <-+        let mb_instances  = lookupNameEnv index (tcdName d)+            cls_instances = maybeToList mb_instances >>= fst+            fam_instances = maybeToList mb_instances >>= snd+            fam_insts = [ (synifyFamInst i opaque, doc,spanNameE n (synifyFamInst i opaque) (L eSpan (tcdName d)) )+                        | i <- sortBy (comparing instFam) fam_instances+                        , let n = getName i+                        , let doc = instLookup instDocMap n iface ifaceMap instIfaceMap+                        , not $ isNameHidden expInfo (fi_fam i)+                        , not $ any (isTypeHidden expInfo) (fi_tys i)+                        , let opaque = isTypeHidden expInfo (fi_rhs i)+                        ]+            cls_insts = [ (synifyInstHead i, instLookup instDocMap n iface ifaceMap instIfaceMap, spanName n (synifyInstHead i) (L eSpan (tcdName d)))+                        | let is = [ (instanceSig i, getName i) | i <- cls_instances ]+                        , (i@(_,_,cls,tys), n) <- sortBy (comparing $ first instHead) is+                        , not $ isInstanceHidden expInfo cls tys+                        ]               -- fam_insts but with failing type fams filtered out-              cleanFamInsts = [ (fi, n, L l r) | (Right fi, n, L l (Right r)) <- fam_insts ]-              famInstErrs = [ errm | (Left errm, _, _) <- fam_insts ]-          in do-            dfs <- getDynFlags-            let mkBug = (text "haddock-bug:" <+>) . text-            liftIO $ putMsg dfs (sep $ map mkBug famInstErrs)-            return $ cls_insts ++ cleanFamInsts-        Nothing -> return []+            cleanFamInsts = [ (fi, n, L l r) | (Right fi, n, L l (Right r)) <- fam_insts ]+            famInstErrs = [ errm | (Left errm, _, _) <- fam_insts ]+        in do+          dfs <- getDynFlags+          let mkBug = (text "haddock-bug:" <+>) . text+          liftIO $ putMsg dfs (sep $ map mkBug famInstErrs)+          return $ cls_insts ++ cleanFamInsts       return $ e { expItemInstances = insts }     e -> return e   where-    attachFixities e@ExportDecl{ expItemDecl = L _ d } = e { expItemFixities =-      nubBy ((==) `on` fst) $ expItemFixities e +++    attachFixities e@ExportDecl{ expItemDecl = L _ d+                               , expItemPats = patsyns+                               } = e { expItemFixities =+      nubByName fst $ expItemFixities e ++       [ (n',f) | n <- getMainDeclBinder d-              , Just subs <- [instLookup instSubMap n iface ifaceMap instIfaceMap]-              , n' <- n : subs+              , Just subs <- [instLookup instSubMap n iface ifaceMap instIfaceMap <|> Just []]+              , n' <- n : (subs ++ patsyn_names)               , Just f <- [instLookup instFixMap n' iface ifaceMap instIfaceMap]       ] }+      where+        patsyn_names = concatMap (getMainDeclBinder . fst) patsyns      attachFixities e = e     -- spanName: attach the location to the name that is the same file as the instance location@@ -142,14 +152,6 @@       iface' <- Map.lookup (nameModule name) ifaceMaps       Map.lookup name (f iface') --- | Like GHC's getInfo but doesn't cut things out depending on the--- interative context, which we don't set sufficiently anyway.-getAllInfo :: GhcMonad m => Name -> m (Maybe (TyThing,Fixity,[ClsInst],[FamInst]))-getAllInfo name = withSession $ \hsc_env -> do-   (_msgs, r) <- liftIO $ tcRnGetInfo hsc_env name-   return r-- -------------------------------------------------------------------------------- -- Collecting and sorting instances --------------------------------------------------------------------------------@@ -169,15 +171,15 @@   = (map argCount args, className cls, map simplify args)  argCount :: Type -> Int-argCount (AppTy t _) = argCount t + 1+argCount (AppTy t _)     = argCount t + 1 argCount (TyConApp _ ts) = length ts-argCount (ForAllTy (Anon _) _ ) = 2-argCount (ForAllTy _ t) = argCount t-argCount (CastTy t _) = argCount t+argCount (FunTy _ _ )    = 2+argCount (ForAllTy _ t)  = argCount t+argCount (CastTy t _)    = argCount t argCount _ = 0  simplify :: Type -> SimpleType-simplify (ForAllTy (Anon t1) t2) = SimpleType funTyConName [simplify t1, simplify t2]+simplify (FunTy t1 t2)  = SimpleType funTyConName [simplify t1, simplify t2] simplify (ForAllTy _ t) = simplify t simplify (AppTy t1 t2) = SimpleType s (ts ++ maybeToList (simplify_maybe t2))   where (SimpleType s ts) = simplify t1@@ -239,8 +241,9 @@       case t of         TyVarTy {} -> False         AppTy t1 t2 -> typeHidden t1 || typeHidden t2+        FunTy t1 t2 -> typeHidden t1 || typeHidden t2         TyConApp tcon args -> nameHidden (getName tcon) || any typeHidden args-        ForAllTy bndr ty -> typeHidden (binderType bndr) || typeHidden ty+        ForAllTy bndr ty -> typeHidden (tyVarKind (binderVar bndr)) || typeHidden ty         LitTy _ -> False         CastTy ty _ -> typeHidden ty         CoercionTy {} -> False
haddock-api/src/Haddock/Interface/Create.hs view
@@ -11,10 +11,15 @@ -- Maintainer  :  haddock@projects.haskell.org -- Stability   :  experimental -- Portability :  portable+--+-- This module provides a single function 'createInterface',+-- which creates a Haddock 'Interface' from the typechecking+-- results 'TypecheckedModule' from GHC. ----------------------------------------------------------------------------- module Haddock.Interface.Create (createInterface) where  import Documentation.Haddock.Doc (metaDocAppend)+import Documentation.Haddock.Utf8 as Utf8 import Haddock.Types import Haddock.Options import Haddock.GhcUtils@@ -25,6 +30,7 @@ import Haddock.Backends.Hyperlinker.Ast as Hyperlinker import Haddock.Backends.Hyperlinker.Parser as Hyperlinker +import qualified Data.ByteString as BS import qualified Data.Map as M import Data.Map (Map) import Data.List@@ -33,9 +39,10 @@ import Data.Ord import Control.Applicative import Control.Arrow (second)-import Control.DeepSeq+import Control.DeepSeq (force)+import Control.Exception (evaluate) import Control.Monad-import Data.Function (on)+import Data.Traversable  import qualified Packages import qualified Module@@ -43,18 +50,23 @@ import GHC import HscTypes import Name+import NameSet import Bag import RdrName import TcRnTypes import FastString (concatFS)-import BasicTypes ( StringLiteral(..) )+import BasicTypes ( StringLiteral(..), SourceText(..) ) import qualified Outputable as O import HsDecls ( getConDetails )  -- | Use a 'TypecheckedModule' to produce an 'Interface'. -- To do this, we need access to already processed modules in the topological -- sort. That's what's in the 'IfaceMap'.-createInterface :: TypecheckedModule -> [Flag] -> IfaceMap -> InstIfaceMap -> ErrMsgGhc Interface+createInterface :: TypecheckedModule+                -> [Flag]       -- Boolean flags+                -> IfaceMap     -- Locally processed modules+                -> InstIfaceMap -- External, already installed interfaces+                -> ErrMsgGhc Interface createInterface tm flags modMap instIfaceMap = do    let ms             = pm_mod_summary . tm_parsed_module $ tm@@ -62,12 +74,17 @@       L _ hsm        = parsedSource tm       !safety        = modInfoSafe mi       mdl            = ms_mod ms+      sem_mdl        = tcg_semantic_mod (fst (tm_internals_ tm))+      is_sig         = ms_hsc_src ms == HsigFile       dflags         = ms_hspp_opts ms       !instances     = modInfoInstances mi       !fam_instances = md_fam_insts md-      !exportedNames = modInfoExports mi+      !exportedNames = modInfoExportsWithSelectors mi -      (TcGblEnv {tcg_rdr_env = gre, tcg_warns = warnings}, md) = tm_internals_ tm+      (TcGblEnv { tcg_rdr_env = gre+                , tcg_warns   = warnings+                , tcg_patsyns = patsyns+                }, md) = tm_internals_ tm    -- The renamed source should always be available to us, but it's best   -- to be on the safe side.@@ -83,29 +100,49 @@         | Flag_IgnoreAllExports `elem` flags = OptIgnoreExports : opts0         | otherwise = opts0 +  -- Process the top-level module header documentation.   (!info, mbDoc) <- liftErrMsg $ processModuleHeader dflags gre safety mayDocHeader    let declsWithDocs = topDecls group_++      exports0 = fmap (reverse . map unLoc) mayExports+      exports+        | OptIgnoreExports `elem` opts = Nothing+        | otherwise = exports0+      warningMap = mkWarningMap dflags warnings gre exportedNames++      localBundledPatSyns :: Map Name [Name]+      localBundledPatSyns =+        case exports of+          Nothing  -> M.empty+          Just ies ->+            M.map (nubByName id) $+            M.fromListWith (++) [ (ieWrappedName ty_name, bundled_patsyns)+                                | IEThingWith (L _ ty_name) _ exported _ <- ies+                                , let bundled_patsyns =+                                        filter is_patsyn (map (ieWrappedName . unLoc) exported)+                                , not (null bundled_patsyns)+                                ]+        where+          is_patsyn name = elemNameSet name (mkNameSet (map getName patsyns))+       fixMap = mkFixMap group_       (decls, _) = unzip declsWithDocs-      localInsts = filter (nameIsLocalOrFrom mdl) $  map getName instances-                                                  ++ map getName fam_instances+      localInsts = filter (nameIsLocalOrFrom sem_mdl)+                        $  map getName instances+                        ++ map getName fam_instances       -- Locations of all TH splices       splices = [ l | L l (SpliceD _) <- hsmodDecls hsm ]        maps@(!docMap, !argMap, !subMap, !declMap, _) =         mkMaps dflags gre localInsts declsWithDocs -  let exports0 = fmap (reverse . map unLoc) mayExports-      exports-        | OptIgnoreExports `elem` opts = Nothing-        | otherwise = exports0-      warningMap = mkWarningMap dflags warnings gre exportedNames-   let allWarnings = M.unions (warningMap : map ifaceWarningMap (M.elems modMap)) -  exportItems <- mkExportItems modMap mdl allWarnings gre exportedNames decls-                   maps fixMap splices exports instIfaceMap dflags+  -- The MAIN functionality: compute the export items which will+  -- each be the actual documentation of this module.+  exportItems <- mkExportItems is_sig modMap mdl sem_mdl allWarnings gre exportedNames decls+                   maps localBundledPatSyns fixMap splices exports instIfaceMap dflags    let !visibleNames = mkVisibleNames maps exportItems opts @@ -129,33 +166,39 @@   tokenizedSrc <- mkMaybeTokenizedSrc flags tm    return $! Interface {-    ifaceMod             = mdl-  , ifaceOrigFilename    = msHsFilePath ms-  , ifaceInfo            = info-  , ifaceDoc             = Documentation mbDoc modWarn-  , ifaceRnDoc           = Documentation Nothing Nothing-  , ifaceOptions         = opts-  , ifaceDocMap          = docMap-  , ifaceArgMap          = argMap-  , ifaceRnDocMap        = M.empty-  , ifaceRnArgMap        = M.empty-  , ifaceExportItems     = prunedExportItems-  , ifaceRnExportItems   = []-  , ifaceExports         = exportedNames-  , ifaceVisibleExports  = visibleNames-  , ifaceDeclMap         = declMap-  , ifaceSubMap          = subMap-  , ifaceFixMap          = fixMap-  , ifaceModuleAliases   = aliases-  , ifaceInstances       = instances-  , ifaceFamInstances    = fam_instances+    ifaceMod               = mdl+  , ifaceIsSig             = is_sig+  , ifaceOrigFilename      = msHsFilePath ms+  , ifaceInfo              = info+  , ifaceDoc               = Documentation mbDoc modWarn+  , ifaceRnDoc             = Documentation Nothing Nothing+  , ifaceOptions           = opts+  , ifaceDocMap            = docMap+  , ifaceArgMap            = argMap+  , ifaceRnDocMap          = M.empty+  , ifaceRnArgMap          = M.empty+  , ifaceExportItems       = prunedExportItems+  , ifaceRnExportItems     = []+  , ifaceExports           = exportedNames+  , ifaceVisibleExports    = visibleNames+  , ifaceDeclMap           = declMap+  , ifaceBundledPatSynMap  = localBundledPatSyns+  , ifaceSubMap            = subMap+  , ifaceFixMap            = fixMap+  , ifaceModuleAliases     = aliases+  , ifaceInstances         = instances+  , ifaceFamInstances      = fam_instances   , ifaceOrphanInstances   = [] -- Filled in `attachInstances`   , ifaceRnOrphanInstances = [] -- Filled in `renameInterface`-  , ifaceHaddockCoverage = coverage-  , ifaceWarningMap      = warningMap-  , ifaceTokenizedSrc    = tokenizedSrc+  , ifaceHaddockCoverage   = coverage+  , ifaceWarningMap        = warningMap+  , ifaceTokenizedSrc      = tokenizedSrc   } +-- | Given all of the @import M as N@ declarations in a package,+-- create a mapping from the module identity of M, to an alias N+-- (if there are multiple aliases, we pick the last one.)  This+-- will go in 'ifaceModuleAliases'. mkAliasMap :: DynFlags -> Maybe RenamedSource -> M.Map Module ModuleName mkAliasMap dflags mRenamedSource =   case mRenamedSource of@@ -163,16 +206,31 @@     Just (_,impDecls,_,_) ->       M.fromList $       mapMaybe (\(SrcLoc.L _ impDecl) -> do-        alias <- ideclAs impDecl+        SrcLoc.L _ alias <- ideclAs impDecl         return $           (lookupModuleDyn dflags+             -- TODO: This is supremely dodgy, because in general the+             -- UnitId isn't going to look anything like the package+             -- qualifier (even with old versions of GHC, the+             -- IPID would be p-0.1, but a package qualifier never+             -- has a version number it.  (Is it possible that in+             -- Haddock-land, the UnitIds never have version numbers?+             -- I, ezyang, have not quite understand Haddock's package+             -- identifier model.)+             --+             -- Additionally, this is simulating some logic GHC already+             -- has for deciding how to qualify names when it outputs+             -- them to the user.  We should reuse that information;+             -- or at least reuse the renamed imports, which know what+             -- they import!              (fmap Module.fsToUnitId $               fmap sl_fs $ ideclPkgQual impDecl)              (case ideclName impDecl of SrcLoc.L _ name -> name),            alias))         impDecls --- similar to GHC.lookupModule+-- Similar to GHC.lookupModule+-- ezyang: Not really... lookupModuleDyn ::   DynFlags -> Maybe UnitId -> ModuleName -> Module lookupModuleDyn _ (Just pkgId) mdlName =@@ -257,8 +315,14 @@        -> [(LHsDecl Name, [HsDocString])]        -> Maps mkMaps dflags gre instances decls =-  let (a, b, c, d) = unzip4 $ map mappings decls-  in (f' $ map (nubBy ((==) `on` fst)) a , f b, f c, f d, instanceMap)+  let+    (a, b, c, d) = unzip4 $ map mappings decls+  in ( f' (map (nubByName fst) a)+     , f  (filterMapping (not . M.null) b)+     , f  (filterMapping (not . null) c)+     , f  (filterMapping (not . null) d)+     , instanceMap+     )   where     f :: (Ord a, Monoid b) => [[(a, b)]] -> Map a b     f = M.fromListWith (<>) . concat@@ -266,6 +330,9 @@     f' :: [[(Name, MDoc Name)]] -> Map Name (MDoc Name)     f' = M.fromListWith metaDocAppend . concat +    filterMapping :: (b -> Bool) ->  [[(a, b)]] -> [[(a, b)]]+    filterMapping p = map (filter (p . snd))+     mappings :: (LHsDecl Name, [HsDocString])              -> ( [(Name, MDoc Name)]                 , [(Name, Map Int (MDoc Name))]@@ -305,16 +372,16 @@       where loc = case d of               TyFamInstD _ -> l -- The CoAx's loc is the whole line, but only for TFs               _ -> getInstLoc d+    names l (DerivD {}) = maybeToList (M.lookup l instanceMap) -- See note [2].     names _ decl = getMainDeclBinder decl  -- Note [2]: --------------- We relate ClsInsts to InstDecls using the SrcSpans buried inside them.--- That should work for normal user-written instances (from looking at GHC--- sources). We can assume that commented instances are user-written.--- This lets us relate Names (from ClsInsts) to comments (associated--- with InstDecls).-+-- We relate ClsInsts to InstDecls and DerivDecls using the SrcSpans buried+-- inside them. That should work for normal user-written instances (from+-- looking at GHC sources). We can assume that commented instances are+-- user-written. This lets us relate Names (from ClsInsts) to comments+-- (associated with InstDecls and DerivDecls).  -------------------------------------------------------------------------------- -- Declarations@@ -322,7 +389,11 @@   -- | Get all subordinate declarations inside a declaration, and their docs.-subordinates :: InstMap -> HsDecl Name -> [(Name, [HsDocString], Map Int HsDocString)]+-- A subordinate declaration is something like the associate type or data+-- family of a type class.+subordinates :: InstMap+             -> HsDecl Name+             -> [(Name, [HsDocString], Map Int HsDocString)] subordinates instMap decl = case decl of   InstD (ClsInstD d) -> do     DataFamInstDecl { dfid_tycon = L l _@@ -338,7 +409,7 @@                    , name <- getMainDeclBinder d, not (isValD d)                    ]     dataSubs :: HsDataDefn Name -> [(Name, [HsDocString], Map Int HsDocString)]-    dataSubs dd = constrs ++ fields+    dataSubs dd = constrs ++ fields ++ derivs       where         cons = map unL $ (dd_cons dd)         constrs = [ (unL cname, maybeToList $ fmap unL $ con_doc c, M.empty)@@ -347,14 +418,20 @@                   | RecCon flds <- map getConDetails cons                   , L _ (ConDeclField ns _ doc) <- (unLoc flds)                   , L _ n <- ns ]+        derivs  = [ (instName, [unL doc], M.empty)+                  | HsIB { hsib_body = L l (HsDocTy _ doc) }+                      <- concatMap (unLoc . deriv_clause_tys . unLoc) $+                           unLoc $ dd_derivs dd+                  , Just instName <- [M.lookup l instMap] ]  -- | Extract function argument docs from inside types. typeDocs :: HsDecl Name -> Map Int HsDocString typeDocs d =   let docs = go 0 in   case d of-    SigD (TypeSig _ ty)   -> docs (unLoc (hsSigWcType ty))-    SigD (PatSynSig _ ty) -> docs (unLoc (hsSigType ty))+    SigD (TypeSig _ ty)      -> docs (unLoc (hsSigWcType ty))+    SigD (ClassOpSig _ _ ty) -> docs (unLoc (hsSigType ty))+    SigD (PatSynSig _ ty)    -> docs (unLoc (hsSigType ty))     ForD (ForeignImport _ ty _ _)   -> docs (unLoc (hsSigType ty))     TyClD (SynDecl { tcdRhs = ty }) -> docs (unLoc ty)     _ -> M.empty@@ -394,12 +471,12 @@ -- | Take all declarations except pragmas, infix decls, rules from an 'HsGroup'. ungroup :: HsGroup Name -> [LHsDecl Name] ungroup group_ =-  mkDecls (tyClGroupConcat . hs_tyclds) TyClD  group_ +++  mkDecls (tyClGroupTyClDecls . hs_tyclds) TyClD  group_ ++   mkDecls hs_derivds             DerivD group_ ++   mkDecls hs_defds               DefD   group_ ++   mkDecls hs_fords               ForD   group_ ++   mkDecls hs_docs                DocD   group_ ++-  mkDecls hs_instds              InstD  group_ +++  mkDecls (tyClGroupInstDecls . hs_tyclds) InstD  group_ ++   mkDecls (typesigs . hs_valds)  SigD   group_ ++   mkDecls (valbinds . hs_valds)  ValD   group_   where@@ -433,8 +510,9 @@ filterDecls = filter (isHandled . unL . fst)   where     isHandled (ForD (ForeignImport {})) = True-    isHandled (TyClD {}) = True-    isHandled (InstD {}) = True+    isHandled (TyClD {})  = True+    isHandled (InstD {})  = True+    isHandled (DerivD {}) = True     isHandled (SigD d) = isUserLSig (reL d)     isHandled (ValD _) = True     -- we keep doc declarations to be able to get at named docs@@ -484,13 +562,16 @@ -- We create the export items even if the module is hidden, since they -- might be useful when creating the export items for other modules. mkExportItems-  :: IfaceMap+  :: Bool               -- is it a signature+  -> IfaceMap   -> Module             -- this module+  -> Module             -- semantic module   -> WarningMap   -> GlobalRdrEnv   -> [Name]             -- exported names (orig)-  -> [LHsDecl Name]+  -> [LHsDecl Name]     -- renamed source declarations   -> Maps+  -> Map Name [Name]   -> FixMap   -> [SrcSpan]          -- splice locations   -> Maybe [IE Name]@@ -498,17 +579,28 @@   -> DynFlags   -> ErrMsgGhc [ExportItem Name] mkExportItems-  modMap thisMod warnings gre exportedNames decls-  maps@(docMap, argMap, subMap, declMap, instMap) fixMap splices optExports instIfaceMap dflags =+  is_sig modMap thisMod semMod warnings gre exportedNames decls+  maps@(docMap, argMap, subMap, declMap, instMap) patSynMap fixMap splices optExports instIfaceMap dflags =   case optExports of     Nothing -> fullModuleContents dflags warnings gre maps fixMap splices decls     Just exports -> liftM concat $ mapM lookupExport exports   where-    lookupExport (IEVar (L _ x))         = declWith x-    lookupExport (IEThingAbs (L _ t))    = declWith t-    lookupExport (IEThingAll (L _ t))    = declWith t-    lookupExport (IEThingWith (L _ t) _ _ _) = declWith t+    lookupExport (IEVar (L _ x))         = declWith [] $ ieWrappedName x+    lookupExport (IEThingAbs (L _ t))    = declWith [] $ ieWrappedName t+    lookupExport (IEThingAll (L _ t))    = do+      let name     = ieWrappedName t+      pats <- findBundledPatterns name+      declWith pats name+    lookupExport (IEThingWith (L _ t) _ _ _) = do+      let name     = ieWrappedName t+      pats <- findBundledPatterns name+      declWith pats name     lookupExport (IEModuleContents (L _ m)) =+      -- TODO: We could get more accurate reporting here if IEModuleContents+      -- also recorded the actual names that are exported here.  We CAN+      -- compute this info using @gre@ but 'moduleExports does not seem to+      -- do so.+      -- NB: Pass in identity module, so we can look it up in index correctly       moduleExports thisMod m dflags warnings gre exportedNames decls modMap instIfaceMap maps fixMap splices     lookupExport (IEGroup lev docStr)  = return $       return . ExportGroup lev "" $ processDocString dflags gre docStr@@ -521,9 +613,10 @@         Nothing -> []         Just doc -> return . ExportDoc $ processDocStringParas dflags gre doc -    declWith :: Name -> ErrMsgGhc [ ExportItem Name ]-    declWith t =-      case findDecl t of+    declWith :: [(HsDecl Name, DocForDecl Name)] -> Name -> ErrMsgGhc [ ExportItem Name ]+    declWith pats t = do+      r <- findDecl t+      case r of         ([L l (ValD _)], (doc, _)) -> do           -- Top-level binding without type signature           export <- hiValExportItem dflags t l doc (l `elem` splices) $ M.lookup t fixMap@@ -558,15 +651,15 @@                     -- fromJust is safe since we already checked in guards                     -- that 't' is a name declared in this declaration.                     let newDecl = L loc . SigD . fromJust $ filterSigNames (== t) sig-                    in return [ mkExportDecl t newDecl docs_ ]+                    in return [ mkExportDecl t newDecl pats docs_ ]                    L loc (TyClD cl@ClassDecl{}) -> do                     mdef <- liftGhcToErrMsgGhc $ minimalDef t-                    let sig = maybeToList $ fmap (noLoc . MinimalSig mempty . noLoc . fmap noLoc) mdef+                    let sig = maybeToList $ fmap (noLoc . MinimalSig NoSourceText . noLoc . fmap noLoc) mdef                     return [ mkExportDecl t-                      (L loc $ TyClD cl { tcdSigs = sig ++ tcdSigs cl }) docs_ ]+                      (L loc $ TyClD cl { tcdSigs = sig ++ tcdSigs cl }) pats docs_ ] -                  _ -> return [ mkExportDecl t decl docs_ ]+                  _ -> return [ mkExportDecl t decl pats docs_ ]          -- Declaration from another package         ([], _) -> do@@ -576,42 +669,105 @@             Just decl ->               -- We try to get the subs and docs               -- from the installed .haddock file for that package.+              -- TODO: This needs to be more sophisticated to deal+              -- with signature inheritance               case M.lookup (nameModule t) instIfaceMap of                 Nothing -> do                    liftErrMsg $ tell                       ["Warning: Couldn't find .haddock for export " ++ pretty dflags t]                    let subs_ = [ (n, noDocForDecl) | (n, _, _) <- subordinates instMap (unLoc decl) ]-                   return [ mkExportDecl t decl (noDocForDecl, subs_) ]+                   return [ mkExportDecl t decl pats (noDocForDecl, subs_) ]                 Just iface ->-                   return [ mkExportDecl t decl (lookupDocs t warnings (instDocMap iface) (instArgMap iface) (instSubMap iface)) ]+                   return [ mkExportDecl t decl pats (lookupDocs t warnings (instDocMap iface) (instArgMap iface) (instSubMap iface)) ]          _ -> return []  -    mkExportDecl :: Name -> LHsDecl Name -> (DocForDecl Name, [(Name, DocForDecl Name)]) -> ExportItem Name-    mkExportDecl name decl (doc, subs) = decl'+    mkExportDecl :: Name -> LHsDecl Name -> [(HsDecl Name, DocForDecl Name)]+                 -> (DocForDecl Name, [(Name, DocForDecl Name)]) -> ExportItem Name+    mkExportDecl name decl pats (doc, subs) = decl'       where-        decl' = ExportDecl (restrictTo sub_names (extractDecl name mdl decl)) doc subs' [] fixities False-        mdl = nameModule name+        decl' = ExportDecl (restrictTo sub_names (extractDecl name decl)) pats' doc subs' [] fixities False         subs' = filter (isExported . fst) subs+        pats' = [ d | d@(patsyn_decl, _) <- pats+                    , all isExported (getMainDeclBinder patsyn_decl) ]         sub_names = map fst subs'-        fixities = [ (n, f) | n <- name:sub_names, Just f <- [M.lookup n fixMap] ]---    isExported = (`elem` exportedNames)+        pat_names = [ n | (patsyn_decl, _) <- pats', n <- getMainDeclBinder patsyn_decl]+        fixities = [ (n, f) | n <- name:sub_names++pat_names, Just f <- [M.lookup n fixMap] ] +    exportedNameSet = mkNameSet exportedNames+    isExported n = elemNameSet n exportedNameSet -    findDecl :: Name -> ([LHsDecl Name], (DocForDecl Name, [(Name, DocForDecl Name)]))+    findDecl :: Name -> ErrMsgGhc ([LHsDecl Name], (DocForDecl Name, [(Name, DocForDecl Name)]))     findDecl n-      | m == thisMod, Just ds <- M.lookup n declMap =-          (ds, lookupDocs n warnings docMap argMap subMap)-      | Just iface <- M.lookup m modMap, Just ds <- M.lookup n (ifaceDeclMap iface) =-          (ds, lookupDocs n warnings (ifaceDocMap iface) (ifaceArgMap iface) (ifaceSubMap iface))-      | otherwise = ([], (noDocForDecl, []))+      | m == semMod =+          case M.lookup n declMap of+            Just ds -> return (ds, lookupDocs n warnings docMap argMap subMap)+            Nothing+              | is_sig -> do+                -- OK, so it wasn't in the local declaration map.  It could+                -- have been inherited from a signature.  Reconstitute it+                -- from the type.+                mb_r <- hiDecl dflags n+                case mb_r of+                    Nothing -> return ([], (noDocForDecl, []))+                    -- TODO: If we try harder, we might be able to find+                    -- a Haddock!  Look in the Haddocks for each thing in+                    -- requirementContext (pkgState)+                    Just decl -> return ([decl], (noDocForDecl, []))+              | otherwise ->+                return ([], (noDocForDecl, []))+      | Just iface <- M.lookup (semToIdMod (moduleUnitId thisMod) m) modMap+      , Just ds <- M.lookup n (ifaceDeclMap iface) =+          return (ds, lookupDocs n warnings+                            (ifaceDocMap iface)+                            (ifaceArgMap iface)+                            (ifaceSubMap iface))+      | otherwise = return ([], (noDocForDecl, []))       where         m = nameModule n +    findBundledPatterns :: Name -> ErrMsgGhc [(HsDecl Name, DocForDecl Name)]+    findBundledPatterns t =+      let+        m = nameModule t +        local_bundled_patsyns =+          M.findWithDefault [] t patSynMap++        iface_bundled_patsyns+          | Just iface <- M.lookup (semToIdMod (moduleUnitId thisMod) m) modMap+          , Just patsyns <- M.lookup t (ifaceBundledPatSynMap iface)+          = patsyns++          | Just iface <- M.lookup m instIfaceMap+          , Just patsyns <- M.lookup t (instBundledPatSynMap iface)+          = patsyns++          | otherwise+          = []++        patsyn_decls = do+          for (local_bundled_patsyns ++ iface_bundled_patsyns) $ \patsyn_name -> do+            -- call declWith here so we don't have to prepare the pattern synonym for+            -- showing ourselves.+            export_items <- declWith [] patsyn_name+            pure [ (unLoc patsyn_decl, patsyn_doc)+                 | ExportDecl {+                       expItemDecl  = patsyn_decl+                     , expItemMbDoc = patsyn_doc+                     } <- export_items+                 ]++      in concat <$> patsyn_decls++-- | Given a 'Module' from a 'Name', convert it into a 'Module' that+-- we can actually find in the 'IfaceMap'.+semToIdMod :: UnitId -> Module -> Module+semToIdMod this_uid m+    | Module.isHoleModule m = mkModule this_uid (moduleName m)+    | otherwise      = m+ hiDecl :: DynFlags -> Name -> ErrMsgGhc (Maybe (LHsDecl Name)) hiDecl dflags t = do   mayTyThing <- liftGhcToErrMsgGhc $ lookupName t@@ -639,7 +795,7 @@   mayDecl <- hiDecl dflags name   case mayDecl of     Nothing -> return (ExportNoDecl name [])-    Just decl -> return (ExportDecl (fixSpan decl) doc [] [] fixities splice)+    Just decl -> return (ExportDecl (fixSpan decl) [] doc [] [] fixities splice)   where     fixSpan (L l t) = L (SrcLoc.combineSrcSpans l nLoc) t     fixities = case fixity of@@ -673,13 +829,13 @@ --    only return those that are. -- 3) B is visible and all its exports are in scope, in which case we return --    a single 'ExportModule' item.-moduleExports :: Module           -- ^ Module A+moduleExports :: Module           -- ^ Module A (identity, NOT semantic)               -> ModuleName       -- ^ The real name of B, the exported module               -> DynFlags         -- ^ The flags used when typechecking A               -> WarningMap               -> GlobalRdrEnv     -- ^ The renaming environment used for A               -> [Name]           -- ^ All the exports of A-              -> [LHsDecl Name]   -- ^ All the declarations in A+              -> [LHsDecl Name]   -- ^ All the renamed declarations in A               -> IfaceMap         -- ^ Already created interfaces               -> InstIfaceMap     -- ^ Interfaces in other packages               -> Maps@@ -687,8 +843,11 @@               -> [SrcSpan]        -- ^ Locations of all TH splices               -> ErrMsgGhc [ExportItem Name] -- ^ Resulting export items moduleExports thisMod expMod dflags warnings gre _exports decls ifaceMap instIfaceMap maps fixMap splices-  | m == thisMod = fullModuleContents dflags warnings gre maps fixMap splices decls+  | expMod == moduleName thisMod+  = fullModuleContents dflags warnings gre maps fixMap splices decls   | otherwise =+    -- NB: we constructed the identity module when looking up in+    -- the IfaceMap.     case M.lookup m ifaceMap of       Just iface         | OptHide `elem` ifaceOptions iface -> return (ifaceExportItems iface)@@ -704,7 +863,7 @@                     "documentation for exported module: " ++ pretty dflags expMod]             return []   where-    m = mkModule unitId expMod+    m = mkModule unitId expMod -- Identity module!     unitId = moduleUnitId thisMod  @@ -725,24 +884,44 @@ -- (For more information, see Trac #69)  -fullModuleContents :: DynFlags -> WarningMap -> GlobalRdrEnv -> Maps -> FixMap -> [SrcSpan]-                   -> [LHsDecl Name] -> ErrMsgGhc [ExportItem Name]+-- | Simplified variant of 'mkExportItems', where we can assume that+-- every locally defined declaration is exported; thus, we just+-- zip through the renamed declarations.+fullModuleContents :: DynFlags+                   -> WarningMap+                   -> GlobalRdrEnv      -- ^ The renaming environment+                   -> Maps+                   -> FixMap+                   -> [SrcSpan]         -- ^ Locations of all TH splices+                   -> [LHsDecl Name]    -- ^ All the renamed declarations+                   -> ErrMsgGhc [ExportItem Name] fullModuleContents dflags warnings gre (docMap, argMap, subMap, declMap, instMap) fixMap splices decls =-  liftM catMaybes $ mapM mkExportItem (expandSig decls)+  liftM catMaybes $ mapM mkExportItem (expandSigDecls decls)   where     -- A type signature can have multiple names, like:     --   foo, bar :: Types..     --     -- We go through the list of declarations and expand type signatures, so     -- that every type signature has exactly one name!-    expandSig :: [LHsDecl name] -> [LHsDecl name]-    expandSig = foldr f []+    expandSigDecls :: [LHsDecl name] -> [LHsDecl name]+    expandSigDecls = concatMap f       where-        f :: LHsDecl name -> [LHsDecl name] -> [LHsDecl name]-        f (L l (SigD (TypeSig    names t)))   xs = foldr (\n acc -> L l (SigD (TypeSig      [n] t)) : acc) xs names-        f (L l (SigD (ClassOpSig b names t))) xs = foldr (\n acc -> L l (SigD (ClassOpSig b [n] t)) : acc) xs names-        f x xs = x : xs+        f (L l (SigD sig))              = [ L l (SigD s) | s <- expandSig sig ] +        -- also expand type signatures for class methods+        f (L l (TyClD cls@ClassDecl{})) =+          [ L l (TyClD cls { tcdSigs = concatMap expandLSig (tcdSigs cls) }) ]+        f x = [x]++    expandLSig :: LSig name -> [LSig name]+    expandLSig (L l sig) = [ L l s | s <- expandSig sig ]++    expandSig :: Sig name -> [Sig name]+    expandSig (TypeSig names t)      = [ TypeSig [n] t      | n <- names ]+    expandSig (ClassOpSig b names t) = [ ClassOpSig b [n] t | n <- names ]+    expandSig (PatSynSig names t)    = [ PatSynSig [n] t    | n <- names ]+    expandSig x                      = [x]+     mkExportItem :: LHsDecl Name -> ErrMsgGhc (Maybe (ExportItem Name))     mkExportItem (L _ (DocD (DocGroup lev docStr))) = do       return . Just . ExportGroup lev "" $ processDocString dflags gre docStr@@ -756,11 +935,13 @@       | otherwise = return Nothing     mkExportItem decl@(L l (InstD d))       | Just name <- M.lookup (getInstLoc d) instMap =-        let (doc, subs) = lookupDocs name warnings docMap argMap subMap in-        return $ Just (ExportDecl decl doc subs [] (fixities name subs) (l `elem` splices))+        expInst decl l name+    mkExportItem decl@(L l (DerivD {}))+      | Just name <- M.lookup l instMap =+        expInst decl l name     mkExportItem (L l (TyClD cl@ClassDecl{ tcdLName = L _ name, tcdSigs = sigs })) = do       mdef <- liftGhcToErrMsgGhc $ minimalDef name-      let sig = maybeToList $ fmap (noLoc . MinimalSig mempty . noLoc . fmap noLoc) mdef+      let sig = maybeToList $ fmap (noLoc . MinimalSig NoSourceText . noLoc . fmap noLoc) mdef       expDecl (L l (TyClD cl { tcdSigs = sig ++ sigs })) l name     mkExportItem decl@(L l d)       | name:_ <- getMainDeclBinder d = expDecl decl l name@@ -769,16 +950,20 @@     fixities name subs = [ (n,f) | n <- name : map fst subs                                  , Just f <- [M.lookup n fixMap] ] -    expDecl decl l name = return $ Just (ExportDecl decl doc subs [] (fixities name subs) (l `elem` splices))+    expDecl decl l name = return $ Just (ExportDecl decl [] doc subs [] (fixities name subs) (l `elem` splices))       where (doc, subs) = lookupDocs name warnings docMap argMap subMap +    expInst decl l name =+        let (doc, subs) = lookupDocs name warnings docMap argMap subMap in+        return $ Just (ExportDecl decl [] doc subs [] (fixities name subs) (l `elem` splices)) + -- | Sometimes the declaration we want to export is not the "main" declaration: -- it might be an individual record selector or a class method.  In these -- cases we have to extract the required declaration (and somehow cobble -- together a type signature for it...).-extractDecl :: Name -> Module -> LHsDecl Name -> LHsDecl Name-extractDecl name mdl decl+extractDecl :: Name -> LHsDecl Name -> LHsDecl Name+extractDecl name decl   | name `elem` getMainDeclBinder (unLoc decl) = decl   | otherwise  =     case unLoc decl of@@ -800,11 +985,11 @@                                          O.$$ O.nest 4 (O.ppr matches))       TyClD d@DataDecl {} ->         let (n, tyvar_tys) = (tcdName d, lHsQTyVarsToTypes (tyClDeclTyVars d))-        in SigD <$> extractRecSel name mdl n tyvar_tys (dd_cons (tcdDataDefn d))+        in SigD <$> extractRecSel name n tyvar_tys (dd_cons (tcdDataDefn d))       InstD (DataFamInstD DataFamInstDecl { dfid_tycon = L _ n                                           , dfid_pats = HsIB { hsib_body = tys }                                           , dfid_defn = defn }) ->-        SigD <$> extractRecSel name mdl n tys (dd_cons defn)+        SigD <$> extractRecSel name n tys (dd_cons defn)       InstD (ClsInstD ClsInstDecl { cid_datafam_insts = insts }) ->         let matches = [ d | L _ d <- insts                           -- , L _ ConDecl { con_details = RecCon rec } <- dd_cons (dfid_defn d)@@ -814,19 +999,19 @@                           , selectorFieldOcc n == name                       ]         in case matches of-          [d0] -> extractDecl name mdl (noLoc . InstD $ DataFamInstD d0)+          [d0] -> extractDecl name (noLoc . InstD $ DataFamInstD d0)           _ -> error "internal: extractDecl (ClsInstD)"       _ -> error "internal: extractDecl" -extractRecSel :: Name -> Module -> Name -> [LHsType Name] -> [LConDecl Name]+extractRecSel :: Name -> Name -> [LHsType Name] -> [LConDecl Name]               -> LSig Name-extractRecSel _ _ _ _ [] = error "extractRecSel: selector not found"+extractRecSel _ _ _ [] = error "extractRecSel: selector not found" -extractRecSel nm mdl t tvs (L _ con : rest) =+extractRecSel nm t tvs (L _ con : rest) =   case getConDetails con of     RecCon (L _ fields) | ((l,L _ (ConDeclField _nn ty _)) : _) <- matching_fields fields ->       L l (TypeSig [noLoc nm] (mkEmptySigWcType (noLoc (HsFunTy data_ty (getBangType ty)))))-    _ -> extractRecSel nm mdl t tvs rest+    _ -> extractRecSel nm t tvs rest  where   matching_fields :: [LConDeclField Name] -> [(SrcSpan, LConDeclField Name)]   matching_fields flds = [ (l,f) | f@(L _ (ConDeclField ns _ _)) <- flds@@ -834,7 +1019,7 @@   data_ty     -- ResTyGADT _ ty <- con_res con = ty     | ConDeclGADT{} <- con = hsib_body $ con_type con-    | otherwise = foldl' (\x y -> noLoc (HsAppTy x y)) (noLoc (HsTyVar (noLoc t))) tvs+    | otherwise = foldl' (\x y -> noLoc (HsAppTy x y)) (noLoc (HsTyVar NotPromoted (noLoc t))) tvs  -- | Keep export items with docs. pruneExportItems :: [ExportItem Name] -> [ExportItem Name]@@ -850,8 +1035,9 @@   | otherwise = let ns = concatMap exportName exports                 in seqList ns `seq` ns   where-    exportName e@ExportDecl {} = name ++ subs-      where subs = map fst (expItemSubDocs e)+    exportName e@ExportDecl {} = name ++ subs ++ patsyns+      where subs    = map fst (expItemSubDocs e)+            patsyns = concatMap (getMainDeclBinder . fst) (expItemPats e)             name = case unLoc $ expItemDecl e of               InstD d -> maybeToList $ M.lookup (getInstLoc d) instMap               decl    -> getMainDeclBinder decl@@ -882,10 +1068,11 @@     summary = pm_mod_summary . tm_parsed_module $ tm  mkTokenizedSrc :: ModSummary -> RenamedSource -> IO [RichToken]-mkTokenizedSrc ms src =-    Hyperlinker.enrich src . Hyperlinker.parse <$> rawSrc-  where-    rawSrc = readFile $ msHsFilePath ms+mkTokenizedSrc ms src = do+  -- make sure to read the whole file at once otherwise+  -- we run out of file descriptors (see #495)+  rawSrc <- BS.readFile (msHsFilePath ms) >>= evaluate+  return $ Hyperlinker.enrich src (Hyperlinker.parse (decodeUtf8 rawSrc))  -- | Find a stand-alone documentation comment by its name. findNamedDoc :: String -> [HsDecl Name] -> ErrMsgM (Maybe HsDocString)
haddock-api/src/Haddock/Interface/Rename.hs view
@@ -55,7 +55,7 @@        -- combine the missing names and filter out the built-ins, which would       -- otherwise always be missing.-      missingNames = nub $ filter isExternalName  -- XXX: isExternalName filters out too much+      missingNames = nubByName id $ filter isExternalName  -- XXX: isExternalName filters out too much                     (missingNames1 ++ missingNames2 ++ missingNames3                      ++ missingNames4 ++ missingNames5) @@ -179,7 +179,7 @@ renameLSigType = renameImplicit renameLType  renameLSigWcType :: LHsSigWcType Name -> RnM (LHsSigWcType DocName)-renameLSigWcType = renameImplicit (renameWc renameLType)+renameLSigWcType = renameWc (renameImplicit renameLType)  renameLKind :: LHsKind Name -> RnM (LHsKind DocName) renameLKind = renameLType@@ -219,7 +219,7 @@     ltype'    <- renameLType ltype     return (HsQualTy { hst_ctxt = lcontext', hst_body = ltype' }) -  HsTyVar (L l n) -> return . HsTyVar . L l =<< rename n+  HsTyVar ip (L l n) -> return . HsTyVar ip . L l =<< rename n   HsBangTy b ltype -> return . HsBangTy b =<< renameLType ltype    HsAppTy a b -> do@@ -238,6 +238,7 @@   HsEqTy ty1 ty2 -> liftM2 HsEqTy (renameLType ty1) (renameLType ty2)    HsTupleTy b ts -> return . HsTupleTy b =<< mapM renameLType ts+  HsSumTy ts -> HsSumTy <$> mapM renameLType ts    HsOpTy a (L loc op) b -> do     op' <- rename op@@ -261,7 +262,7 @@    HsRecTy a               -> HsRecTy <$> mapM renameConDeclFieldField a   HsCoreTy a              -> pure (HsCoreTy a)-  HsExplicitListTy  a b   -> HsExplicitListTy  a <$> mapM renameLType b+  HsExplicitListTy i a b  -> HsExplicitListTy i a <$> mapM renameLType b   HsExplicitTupleTy a b   -> HsExplicitTupleTy a <$> mapM renameLType b   HsSpliceTy _ _          -> error "renameType: HsSpliceTy"   HsWildCardTy a          -> HsWildCardTy <$> renameWildCardInfo a@@ -313,6 +314,11 @@ renameLDecl :: LHsDecl Name -> RnM (LHsDecl DocName) renameLDecl (L loc d) = return . L loc =<< renameDecl d +renamePats :: [(HsDecl Name,DocForDecl Name)] -> RnM [(HsDecl DocName,DocForDecl DocName)]+renamePats = mapM+  (\(d,doc) -> do { d'   <- renameDecl d+                  ; doc' <- renameDocForDecl doc+                  ; return (d',doc')})  renameDecl :: HsDecl Name -> RnM (HsDecl DocName) renameDecl decl = case decl of@@ -328,6 +334,9 @@   InstD d -> do     d' <- renameInstD d     return (InstD d')+  DerivD d -> do+    d' <- renameDerivD d+    return (DerivD d')   _ -> error "renameDecl"  renameLThing :: (a Name -> RnM (a DocName)) -> Located (a Name) -> RnM (Located (a DocName))@@ -340,19 +349,19 @@     decl' <- renameFamilyDecl decl     return (FamDecl { tcdFam = decl' }) -  SynDecl { tcdLName = lname, tcdTyVars = tyvars, tcdRhs = rhs, tcdFVs = _fvs } -> do+  SynDecl { tcdLName = lname, tcdTyVars = tyvars, tcdFixity = fixity, tcdRhs = rhs, tcdFVs = _fvs } -> do     lname'    <- renameL lname     tyvars'   <- renameLHsQTyVars tyvars     rhs'     <- renameLType rhs-    return (SynDecl { tcdLName = lname', tcdTyVars = tyvars', tcdRhs = rhs', tcdFVs = placeHolderNames })+    return (SynDecl { tcdLName = lname', tcdTyVars = tyvars', tcdFixity = fixity, tcdRhs = rhs', tcdFVs = placeHolderNames }) -  DataDecl { tcdLName = lname, tcdTyVars = tyvars, tcdDataDefn = defn, tcdFVs = _fvs } -> do+  DataDecl { tcdLName = lname, tcdTyVars = tyvars, tcdFixity = fixity, tcdDataDefn = defn, tcdFVs = _fvs } -> do     lname'    <- renameL lname     tyvars'   <- renameLHsQTyVars tyvars     defn'     <- renameDataDefn defn-    return (DataDecl { tcdLName = lname', tcdTyVars = tyvars', tcdDataDefn = defn', tcdDataCusk = PlaceHolder, tcdFVs = placeHolderNames })+    return (DataDecl { tcdLName = lname', tcdTyVars = tyvars', tcdFixity = fixity, tcdDataDefn = defn', tcdDataCusk = PlaceHolder, tcdFVs = placeHolderNames }) -  ClassDecl { tcdCtxt = lcontext, tcdLName = lname, tcdTyVars = ltyvars+  ClassDecl { tcdCtxt = lcontext, tcdLName = lname, tcdTyVars = ltyvars, tcdFixity = fixity             , tcdFDs = lfundeps, tcdSigs = lsigs, tcdATs = ats, tcdATDefs = at_defs } -> do     lcontext' <- renameLContext lcontext     lname'    <- renameL lname@@ -363,6 +372,7 @@     at_defs'  <- mapM renameLTyFamDefltEqn at_defs     -- we don't need the default methods or the already collected doc entities     return (ClassDecl { tcdCtxt = lcontext', tcdLName = lname', tcdTyVars = ltyvars'+                      , tcdFixity = fixity                       , tcdFDs = lfundeps', tcdSigs = lsigs', tcdMeths= emptyBag                       , tcdATs = ats', tcdATDefs = at_defs', tcdDocs = [], tcdFVs = placeHolderNames }) @@ -376,7 +386,9 @@  renameFamilyDecl :: FamilyDecl Name -> RnM (FamilyDecl DocName) renameFamilyDecl (FamilyDecl { fdInfo = info, fdLName = lname-                             , fdTyVars = ltyvars, fdResultSig = result+                             , fdTyVars = ltyvars+                             , fdFixity = fixity+                             , fdResultSig = result                              , fdInjectivityAnn = injectivity }) = do     info'        <- renameFamilyInfo info     lname'       <- renameL lname@@ -384,7 +396,9 @@     result'      <- renameFamilyResultSig result     injectivity' <- renameMaybeInjectivityAnn injectivity     return (FamilyDecl { fdInfo = info', fdLName = lname'-                       , fdTyVars = ltyvars', fdResultSig = result'+                       , fdTyVars = ltyvars'+                       , fdFixity = fixity+                       , fdResultSig = result'                        , fdInjectivityAnn = injectivity' })  @@ -412,7 +426,8 @@     cons'     <- mapM (mapM renameCon) cons     -- I don't think we need the derivings, so we return Nothing     return (HsDataDefn { dd_ND = nd, dd_ctxt = lcontext', dd_cType = cType-                       , dd_kindSig = k', dd_cons = cons', dd_derivs = Nothing })+                       , dd_kindSig = k', dd_cons = cons'+                       , dd_derivs = noLoc [] })  renameCon :: ConDecl Name -> RnM (ConDecl DocName) renameCon decl@(ConDeclH98 { con_name = lname, con_qvars = ltyvars@@ -467,10 +482,10 @@     lnames' <- mapM renameL lnames     ltype' <- renameLSigType sig_ty     return (ClassOpSig is_default lnames' ltype')-  PatSynSig lname sig_ty -> do-    lname' <- renameL lname+  PatSynSig lnames sig_ty -> do+    lnames' <- mapM renameL lnames     sig_ty' <- renameLSigType sig_ty-    return $ PatSynSig lname' sig_ty'+    return $ PatSynSig lnames' sig_ty'   FixSig (FixitySig lnames fixity) -> do     lnames' <- mapM renameL lnames     return $ FixSig (FixitySig lnames' fixity)@@ -503,6 +518,15 @@   d' <- renameDataFamInstD d   return (DataFamInstD { dfid_inst = d' }) +renameDerivD :: DerivDecl Name -> RnM (DerivDecl DocName)+renameDerivD (DerivDecl { deriv_type = ty+                        , deriv_strategy = strat+                        , deriv_overlap_mode = omode }) = do+  ty' <- renameLSigType ty+  return (DerivDecl { deriv_type = ty'+                    , deriv_strategy = strat+                    , deriv_overlap_mode = omode })+ renameClsInstD :: ClsInstDecl Name -> RnM (ClsInstDecl DocName) renameClsInstD (ClsInstDecl { cid_overlap_mode = omode                             , cid_poly_ty =ltype, cid_tyfam_insts = lATs@@ -523,30 +547,33 @@                                , tfid_fvs = placeHolderNames }) }  renameLTyFamInstEqn :: LTyFamInstEqn Name -> RnM (LTyFamInstEqn DocName)-renameLTyFamInstEqn (L loc (TyFamEqn { tfe_tycon = tc, tfe_pats = pats, tfe_rhs = rhs }))+renameLTyFamInstEqn (L loc (TyFamEqn { tfe_tycon = tc, tfe_pats = pats, tfe_fixity = fixity, tfe_rhs = rhs }))   = do { tc' <- renameL tc        ; pats' <- renameImplicit (mapM renameLType) pats        ; rhs' <- renameLType rhs        ; return (L loc (TyFamEqn { tfe_tycon = tc'                                  , tfe_pats = pats'+                                 , tfe_fixity = fixity                                  , tfe_rhs = rhs' })) }  renameLTyFamDefltEqn :: LTyFamDefltEqn Name -> RnM (LTyFamDefltEqn DocName)-renameLTyFamDefltEqn (L loc (TyFamEqn { tfe_tycon = tc, tfe_pats = tvs, tfe_rhs = rhs }))+renameLTyFamDefltEqn (L loc (TyFamEqn { tfe_tycon = tc, tfe_pats = tvs, tfe_fixity = fixity, tfe_rhs = rhs }))   = do { tc'  <- renameL tc        ; tvs' <- renameLHsQTyVars tvs        ; rhs' <- renameLType rhs        ; return (L loc (TyFamEqn { tfe_tycon = tc'                                  , tfe_pats = tvs'+                                 , tfe_fixity = fixity                                  , tfe_rhs = rhs' })) }  renameDataFamInstD :: DataFamInstDecl Name -> RnM (DataFamInstDecl DocName)-renameDataFamInstD (DataFamInstDecl { dfid_tycon = tc, dfid_pats = pats, dfid_defn = defn })+renameDataFamInstD (DataFamInstDecl { dfid_tycon = tc, dfid_pats = pats, dfid_fixity = fixity, dfid_defn = defn })   = do { tc' <- renameL tc        ; pats' <- renameImplicit (mapM renameLType) pats        ; defn' <- renameDataDefn defn        ; return (DataFamInstDecl { dfid_tycon = tc'                                  , dfid_pats = pats'+                                 , dfid_fixity = fixity                                  , dfid_defn = defn', dfid_fvs = placeHolderNames }) }  renameImplicit :: (in_thing -> RnM out_thing)@@ -555,7 +582,8 @@ renameImplicit rn_thing (HsIB { hsib_body = thing })   = do { thing' <- rn_thing thing        ; return (HsIB { hsib_body = thing'-                      , hsib_vars = PlaceHolder }) }+                      , hsib_vars = PlaceHolder+                      , hsib_closed = PlaceHolder }) }  renameWc :: (in_thing -> RnM out_thing)          -> HsWildCardBndrs Name in_thing@@ -563,7 +591,7 @@ renameWc rn_thing (HsWC { hswc_body = thing })   = do { thing' <- rn_thing thing        ; return (HsWC { hswc_body = thing'-                      , hswc_wcs = PlaceHolder, hswc_ctx = Nothing }) }+                      , hswc_wcs = PlaceHolder }) }  renameDocInstance :: DocInstance Name -> RnM (DocInstance DocName) renameDocInstance (inst, idoc, L l n) = do@@ -578,15 +606,16 @@   ExportGroup lev id_ doc -> do     doc' <- renameDoc doc     return (ExportGroup lev id_ doc')-  ExportDecl decl doc subs instances fixities splice -> do+  ExportDecl decl pats doc subs instances fixities splice -> do     decl' <- renameLDecl decl+    pats' <- renamePats pats     doc'  <- renameDocForDecl doc     subs' <- mapM renameSub subs     instances' <- forM instances renameDocInstance     fixities' <- forM fixities $ \(name, fixity) -> do       name' <- lookupRn name       return (name', fixity)-    return (ExportDecl decl' doc' subs' instances' fixities' splice)+    return (ExportDecl decl' pats' doc' subs' instances' fixities' splice)   ExportNoDecl x subs -> do     x'    <- lookupRn x     subs' <- mapM lookupRn subs
haddock-api/src/Haddock/Interface/Specialize.hs view
@@ -1,9 +1,9 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeApplications #-} {-# LANGUAGE RecordWildCards #-} - module Haddock.Interface.Specialize     ( specializeInstHead     ) where@@ -28,72 +28,64 @@ import Data.Set (Set) import qualified Data.Set as Set ---- | Instantiate all occurrences of given name with particular type.-specialize :: (Eq name, Typeable name)-           => Data a-           => name -> HsType name -> a -> a-specialize name details =-    everywhere $ mkT step-  where-    step (HsTyVar (L _ name')) | name == name' = details-    step typ = typ-- -- | Instantiate all occurrences of given names with corresponding types.------ It is just a convenience function wrapping 'specialize' that supports more--- that one specialization.-specialize' :: (Eq name, Typeable name)+specialize :: forall name a. (Ord name, DataId name, NamedThing name)             => Data a             => [(name, HsType name)] -> a -> a-specialize' = flip $ foldr (uncurry specialize)+specialize specs = go+  where+    go :: forall x. Data x => x -> x+    go = everywhereButType @name $ mkT $ sugar . specialize_ty_var+    specialize_ty_var (HsTyVar _ (L _ name'))+      | Just t <- Map.lookup name' spec_map = t+    specialize_ty_var typ = typ+    -- This is a tricky recursive definition that is guaranteed to terminate+    -- because a type binder cannot be instantiated with a type that depends+    -- on that binder. i.e. @a -> Maybe a@ is invalid+    spec_map = Map.fromList [ (n, go t) | (n, t) <- specs]   -- | Instantiate given binders with corresponding types. -- -- Again, it is just a convenience function around 'specialize'. Note that -- length of type list should be the same as the number of binders.-specializeTyVarBndrs :: (Eq name, DataId name)+specializeTyVarBndrs :: (Ord name, DataId name, NamedThing name)                      => Data a                      => LHsQTyVars name -> [HsType name]                      -> a -> a specializeTyVarBndrs bndrs typs =-    specialize' $ zip bndrs' typs+    specialize $ zip bndrs' typs   where     bndrs' = map (bname . unLoc) . hsq_explicit $ bndrs     bname (UserTyVar (L _ name)) = name     bname (KindedTyVar (L _ name) _) = name  -specializePseudoFamilyDecl :: (Eq name, DataId name)+specializePseudoFamilyDecl :: (Ord name, DataId name, NamedThing name)                            => LHsQTyVars name -> [HsType name]                            -> PseudoFamilyDecl name                            -> PseudoFamilyDecl name specializePseudoFamilyDecl bndrs typs decl =-    decl { pfdTyVars = map specializeTyVars (pfdTyVars decl) }-  where-    specializeTyVars = specializeTyVarBndrs bndrs typs-+  decl {pfdTyVars = map (specializeTyVarBndrs bndrs typs) (pfdTyVars decl)} -specializeSig :: forall name . (Eq name, DataId name, SetName name)+specializeSig :: forall name . (Ord name, DataId name, SetName name, NamedThing name)               => LHsQTyVars name -> [HsType name]               -> Sig name               -> Sig name specializeSig bndrs typs (TypeSig lnames typ) =-    TypeSig lnames (typ { hsib_body = (hsib_body typ) { hswc_body = noLoc typ'}})+  TypeSig lnames (typ {hswc_body = (hswc_body typ) {hsib_body = noLoc typ'}})   where     true_type :: HsType name-    true_type = unLoc (hswc_body (hsib_body typ))+    true_type = unLoc (hsSigWcType typ)     typ' :: HsType name-    typ' = rename fv . sugar $ specializeTyVarBndrs bndrs typs true_type+    typ' = rename fv $ specializeTyVarBndrs bndrs typs true_type     fv = foldr Set.union Set.empty . map freeVariables $ typs specializeSig _ _ sig = sig   -- | Make all details of instance head (signatures, associated types) -- specialized to that particular instance type.-specializeInstHead :: (Eq name, DataId name, SetName name)+specializeInstHead :: (Ord name, DataId name, SetName name, NamedThing name)                    => InstHead name -> InstHead name specializeInstHead ihd@InstHead { ihdInstType = clsi@ClassInst { .. }, .. } =     ihd { ihdInstType = instType' }@@ -115,15 +107,10 @@ -- and @(a, b, c)@. sugar :: forall name. (NamedThing name, DataId name)       => HsType name -> HsType name-sugar =-    everywhere $ mkT step-  where-    step :: HsType name -> HsType name-    step = sugarOperators . sugarTuples . sugarLists-+sugar = sugarOperators . sugarTuples . sugarLists  sugarLists :: NamedThing name => HsType name -> HsType name-sugarLists (HsAppTy (L _ (HsTyVar (L _ name))) ltyp)+sugarLists (HsAppTy (L _ (HsTyVar _ (L _ name))) ltyp)     | isBuiltInSyntax name' && strName == "[]" = HsListTy ltyp   where     name' = getName name@@ -137,7 +124,7 @@   where     aux apps (HsAppTy (L _ ftyp) atyp) = aux (atyp:apps) ftyp     aux apps (HsParTy (L _ typ')) = aux apps typ'-    aux apps (HsTyVar (L _ name))+    aux apps (HsTyVar _ (L _ name))         | isBuiltInSyntax name' && suitable = HsTupleTy HsBoxedTuple apps       where         name' = getName name@@ -149,7 +136,7 @@   sugarOperators :: NamedThing name => HsType name -> HsType name-sugarOperators (HsAppTy (L _ (HsAppTy (L _ (HsTyVar (L l name))) la)) lb)+sugarOperators (HsAppTy (L _ (HsAppTy (L _ (HsTyVar _ (L l name))) la)) lb)     | isSymOcc $ getOccName name' = mkHsOpTy la (L l name) lb     | isBuiltInSyntax name' && getOccString name == "(->)" = HsFunTy la lb   where@@ -224,7 +211,7 @@     query term ctx = case cast term :: Maybe (HsType name) of         Just (HsForAllTy bndrs _) ->             (Set.empty, Set.union ctx (bndrsNames bndrs))-        Just (HsTyVar (L _ name))+        Just (HsTyVar _ (L _ name))             | getName name `Set.member` ctx -> (Set.empty, ctx)             | otherwise -> (Set.singleton $ getNameRep name, ctx)         _ -> (Set.empty, ctx)@@ -267,12 +254,13 @@   HsQualTy         <$> located renameContext lctxt         <*> renameLType lt-renameType (HsTyVar name) = HsTyVar <$> located renameName name+renameType (HsTyVar ip name) = HsTyVar ip <$> located renameName name renameType (HsAppTy lf la) = HsAppTy <$> renameLType lf <*> renameLType la renameType (HsFunTy la lr) = HsFunTy <$> renameLType la <*> renameLType lr renameType (HsListTy lt) = HsListTy <$> renameLType lt renameType (HsPArrTy lt) = HsPArrTy <$> renameLType lt renameType (HsTupleTy srt lt) = HsTupleTy srt <$> mapM renameLType lt+renameType (HsSumTy lt) = HsSumTy <$> mapM renameLType lt renameType (HsOpTy la lop lb) =     HsOpTy <$> renameLType la <*> located renameName lop <*> renameLType lb renameType (HsParTy lt) = HsParTy <$> renameLType lt@@ -284,8 +272,8 @@ renameType (HsBangTy bang lt) = HsBangTy bang <$> renameLType lt renameType t@(HsRecTy _) = pure t renameType t@(HsCoreTy _) = pure t-renameType (HsExplicitListTy ph ltys) =-    HsExplicitListTy ph <$> renameLTypes ltys+renameType (HsExplicitListTy ip ph ltys) =+    HsExplicitListTy ip ph <$> renameLTypes ltys renameType (HsExplicitTupleTy phs ltys) =     HsExplicitTupleTy phs <$> renameLTypes ltys renameType t@(HsTyLit _) = pure t
haddock-api/src/Haddock/InterfaceFile.hs view
@@ -38,6 +38,7 @@ import GHC hiding (NoLink) import GhcMonad (withSession) import HscTypes+import NameCache import IfaceEnv import Name import UniqFM@@ -81,8 +82,8 @@ -- (2) set `binaryInterfaceVersionCompatibility` to [binaryInterfaceVersion] -- binaryInterfaceVersion :: Word16-#if (__GLASGOW_HASKELL__ >= 711) && (__GLASGOW_HASKELL__ < 801)-binaryInterfaceVersion = 28+#if (__GLASGOW_HASKELL__ >= 802) && (__GLASGOW_HASKELL__ < 804)+binaryInterfaceVersion = 31  binaryInterfaceVersionCompatibility :: [Word16] binaryInterfaceVersionCompatibility = [binaryInterfaceVersion]@@ -125,6 +126,7 @@    -- put the main thing   let bh = setUserData bh0 $ newWriteState (putName bin_symtab)+                                           (putName bin_symtab)                                            (putFastString bin_dict)   put_ bh iface @@ -370,31 +372,33 @@   instance Binary InstalledInterface where-  put_ bh (InstalledInterface modu info docMap argMap-           exps visExps opts subMap fixMap) = do+  put_ bh (InstalledInterface modu is_sig info docMap argMap+           exps visExps opts subMap patSynMap fixMap) = do     put_ bh modu+    put_ bh is_sig     put_ bh info-    put_ bh docMap-    put_ bh argMap+    lazyPut bh (docMap, argMap)     put_ bh exps     put_ bh visExps     put_ bh opts     put_ bh subMap+    put_ bh patSynMap     put_ bh fixMap    get bh = do     modu    <- get bh+    is_sig  <- get bh     info    <- get bh-    docMap  <- get bh-    argMap  <- get bh+    ~(docMap, argMap) <- lazyGet bh     exps    <- get bh     visExps <- get bh     opts    <- get bh     subMap  <- get bh+    patSynMap <- get bh     fixMap  <- get bh -    return (InstalledInterface modu info docMap argMap-            exps visExps opts subMap fixMap)+    return (InstalledInterface modu is_sig info docMap argMap+            exps visExps opts subMap patSynMap fixMap)   instance Binary DocOption where
haddock-api/src/Haddock/Syb.hs view
@@ -1,8 +1,11 @@ {-# LANGUAGE Rank2Types #-}-+{-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE ScopedTypeVariables #-}  module Haddock.Syb-    ( everything, everythingWithState, everywhere+    ( everything, everythingButType, everythingWithState+    , everywhere, everywhereButType     , mkT     , combine     ) where@@ -10,17 +13,42 @@  import Data.Data import Control.Applicative+import Data.Maybe+import Data.Foldable +-- | Returns true if a == t.+-- requires AllowAmbiguousTypes+isType :: forall a b. (Typeable a, Typeable b) => b -> Bool+isType _ = isJust $ eqT @a @b  -- | Perform a query on each level of a tree. -- -- This is stolen directly from SYB package and copied here to not introduce -- additional dependencies.-everything :: (r -> r -> r) -> (forall a. Data a => a -> r)+everything :: (r -> r -> r)            -> (forall a. Data a => a -> r)-everything k f x = foldl k (f x) (gmapQ (everything k f) x)+           -> (forall a. Data a => a -> r)+everything k f x = foldl' k (f x) (gmapQ (everything k f) x) +-- | Variation of "everything" with an added stop condition+-- Just like 'everything', this is stolen from SYB package.+everythingBut :: (r -> r -> r)+              -> (forall a. Data a => a -> (r, Bool))+              -> (forall a. Data a => a -> r)+everythingBut k f x = let (v, stop) = f x+                      in if stop+                           then v+                           else foldl' k v (gmapQ (everythingBut k f) x) +-- | Variation of "everything" that does not recurse into children of type t+-- requires AllowAmbiguousTypes+everythingButType ::+  forall t r. (Typeable t)+  => (r -> r -> r)+  -> (forall a. Data a => a -> r)+  -> (forall a. Data a => a -> r)+everythingButType k f = everythingBut k $ (,) <$> f <*> isType @t+ -- | Perform a query with state on each level of a tree. -- -- This is the same as 'everything' but allows for stateful computations. In@@ -31,14 +59,29 @@                     -> (forall a. Data a => a -> r) everythingWithState s k f x =     let (r, s') = f x s-    in foldl k r (gmapQ (everythingWithState s' k f) x)-+    in foldl' k r (gmapQ (everythingWithState s' k f) x)  -- | Apply transformation on each level of a tree. -- -- Just like 'everything', this is stolen from SYB package. everywhere :: (forall a. Data a => a -> a) -> (forall a. Data a => a -> a) everywhere f = f . gmapT (everywhere f)++-- | Variation on everywhere with an extra stop condition+-- Just like 'everything', this is stolen from SYB package.+everywhereBut :: (forall a. Data a => a -> Bool)+  -> (forall a. Data a => a -> a)+  -> (forall a. Data a => a -> a)+everywhereBut q f x+    | q x       = x+    | otherwise = f (gmapT (everywhereBut q f) x)++-- | Variation of "everywhere" that does not recurse into children of type t+-- requires AllowAmbiguousTypes+everywhereButType :: forall t . (Typeable t)+  => (forall a. Data a => a -> a)+  -> (forall a. Data a => a -> a)+everywhereButType = everywhereBut (isType @t)  -- | Create generic transformation. --
haddock-api/src/Haddock/Types.hs view
@@ -1,7 +1,10 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE DeriveDataTypeable, DeriveFunctor, DeriveFoldable, DeriveTraversable, StandaloneDeriving #-}-{-# LANGUAGE TypeFamilies, RecordWildCards #-}+{-# LANGUAGE CPP, DeriveDataTypeable, DeriveFunctor, DeriveFoldable, DeriveTraversable, StandaloneDeriving, TypeFamilies, RecordWildCards #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE UndecidableInstances #-} -- Note [Pass sensitive types]+                                      -- in module GHC.PlaceHolder+ {-# OPTIONS_GHC -fno-warn-orphans #-}+ ----------------------------------------------------------------------------- -- | -- Module      :  Haddock.Types@@ -77,6 +80,9 @@     -- | The module behind this interface.     ifaceMod             :: !Module +    -- | Is this a signature?+  , ifaceIsSig           :: !Bool+     -- | Original file name of the module.   , ifaceOrigFilename    :: !FilePath @@ -97,6 +103,9 @@     -- names of subordinate declarations mapped to their parent declarations.   , ifaceDeclMap         :: !(Map Name [LHsDecl Name]) +    -- | Bundled pattern synonym declarations for specific types.+  , ifaceBundledPatSynMap :: !(Map Name [Name])+     -- | Documentation of declarations originating from the module (including     -- subordinates).   , ifaceDocMap          :: !(DocMap Name)@@ -152,45 +161,53 @@ data InstalledInterface = InstalledInterface   {     -- | The module represented by this interface.-    instMod            :: Module+    instMod              :: Module +    -- | Is this a signature?+  , instIsSig            :: Bool+     -- | Textual information about the module.-  , instInfo           :: HaddockModInfo Name+  , instInfo             :: HaddockModInfo Name      -- | Documentation of declarations originating from the module (including     -- subordinates).-  , instDocMap         :: DocMap Name+  , instDocMap           :: DocMap Name -  , instArgMap         :: ArgMap Name+  , instArgMap           :: ArgMap Name      -- | All names exported by this module.-  , instExports        :: [Name]+  , instExports          :: [Name]      -- | All \"visible\" names exported by the module.     -- A visible name is a name that will show up in the documentation of the     -- module.-  , instVisibleExports :: [Name]+  , instVisibleExports   :: [Name]      -- | Haddock options for this module (prune, ignore-exports, etc).-  , instOptions        :: [DocOption]+  , instOptions          :: [DocOption] -  , instSubMap         :: Map Name [Name]-  , instFixMap         :: Map Name Fixity+  , instSubMap           :: Map Name [Name]++  , instBundledPatSynMap :: Map Name [Name]+  +  , instFixMap           :: Map Name Fixity   }   -- | Convert an 'Interface' to an 'InstalledInterface' toInstalledIface :: Interface -> InstalledInterface toInstalledIface interface = InstalledInterface-  { instMod            = ifaceMod            interface-  , instInfo           = ifaceInfo           interface-  , instDocMap         = ifaceDocMap         interface-  , instArgMap         = ifaceArgMap         interface-  , instExports        = ifaceExports        interface-  , instVisibleExports = ifaceVisibleExports interface-  , instOptions        = ifaceOptions        interface-  , instSubMap         = ifaceSubMap         interface-  , instFixMap         = ifaceFixMap         interface+  { instMod              = ifaceMod              interface+  , instIsSig            = ifaceIsSig            interface+  , instInfo             = ifaceInfo             interface+  , instDocMap           = ifaceDocMap           interface+  , instArgMap           = ifaceArgMap           interface+  , instExports          = ifaceExports          interface+  , instVisibleExports   = ifaceVisibleExports   interface+  , instOptions          = ifaceOptions          interface+  , instSubMap           = ifaceSubMap           interface+  , instBundledPatSynMap = ifaceBundledPatSynMap interface+  , instFixMap           = ifaceFixMap           interface   }  @@ -207,6 +224,9 @@         -- | A declaration.         expItemDecl :: !(LHsDecl name) +        -- | Bundled patterns for a data type declaration+      , expItemPats :: ![(HsDecl name, DocForDecl name)]+         -- | Maybe a doc comment, and possibly docs for arguments (if this         -- decl is a function or type-synonym).       , expItemMbDoc :: !(DocForDecl name)@@ -343,7 +363,8 @@   | TypeInst  (Maybe (HsType name)) -- ^ Body (right-hand side)   | DataInst (TyClDecl name)        -- ^ Data constructors -instance OutputableBndr a => Outputable (InstType a) where+instance (OutputableBndrId a)+         => Outputable (InstType a) where   ppr (ClassInst { .. }) = text "ClassInst"       <+> ppr clsiCtx       <+> ppr clsiTyVars@@ -378,8 +399,8 @@     mkType (KindedTyVar (L loc name) lkind) =         HsKindSig tvar lkind       where-        tvar = L loc (HsTyVar (L loc name))-    mkType (UserTyVar name) = HsTyVar name+        tvar = L loc (HsTyVar NotPromoted (L loc name))+    mkType (UserTyVar name) = HsTyVar NotPromoted name   -- | An instance head that may have documentation and a source location.
haddock-api/src/Haddock/Utils.hs view
@@ -128,7 +128,7 @@ mkEmptySigWcType :: LHsType Name -> LHsSigWcType Name -- Dubious, because the implicit binders are empty even -- though the type might have free varaiables-mkEmptySigWcType ty = mkEmptyImplicitBndrs (mkEmptyWildCardBndrs ty)+mkEmptySigWcType ty = mkEmptyWildCardBndrs (mkEmptyImplicitBndrs ty)  addClassContext :: Name -> LHsQTyVars Name -> LSig Name -> LSig Name -- Add the class context to a class-op signature@@ -150,7 +150,7 @@  lHsQTyVarsToTypes :: LHsQTyVars Name -> [LHsType Name] lHsQTyVarsToTypes tvs-  = [ noLoc (HsTyVar (noLoc (hsLTyVarName tv)))+  = [ noLoc (HsTyVar NotPromoted (noLoc (hsLTyVarName tv)))     | tv <- hsQTvExplicit tvs ]  --------------------------------------------------------------------------------
haddock-library/src/Documentation/Haddock/Parser.hs view
@@ -143,7 +143,7 @@ -- to ensure that we have already given a chance to more meaningful parsers -- before capturing their characers. string' :: Parser (DocH mod a)-string' = DocString . unescape . decodeUtf8 <$> takeWhile1_ (`notElem` specialChar)+string' = DocString . unescape . decodeUtf8 <$> takeWhile1_ (notInClass specialChar)   where     unescape "" = ""     unescape ('\\':x:xs) = x : unescape xs@@ -153,7 +153,7 @@ -- This is done to skip over any special characters belonging to other -- elements but which were not deemed meaningful at their positions. skipSpecialChar :: Parser (DocH mod a)-skipSpecialChar = DocString . return <$> satisfy (`elem` specialChar)+skipSpecialChar = DocString . return <$> satisfy (inClass specialChar)  -- | Emphasis parser. --@@ -215,7 +215,7 @@       -- accept {small | large | digit | ' } here.  But as we can't       -- match on unicode characters, this is currently not possible.       -- Note that we allow ‘#’ to suport anchors.-      <*> (decodeUtf8 <$> takeWhile (`notElem` (" .&[{}(=*)+]!|@/;,^?\"\n"::String)))+      <*> (decodeUtf8 <$> takeWhile (notInClass " .&[{}(=*)+]!|@/;,^?\"\n"))  -- | Picture parser, surrounded by \<\< and \>\>. It's possible to specify -- a title for the picture.@@ -338,7 +338,7 @@ definitionList indent = DocDefList <$> p   where     p = do-      label <- "[" *> (parseStringBS <$> takeWhile1 (`notElem` ("]\n" :: String))) <* ("]" <* optional ":")+      label <- "[" *> (parseStringBS <$> takeWhile1 (notInClass "]\n")) <* ("]" <* optional ":")       c <- takeLine       (cs, items) <- more indent p       let contents = parseString . dropNLs . unlines $ c : cs@@ -561,7 +561,7 @@     url = mappend <$> ("http://" <|> "https://" <|> "ftp://") <*> takeWhile1 (not . isSpace)     mkLink :: BS.ByteString -> DocH mod a     mkLink s = case unsnoc s of-      Just (xs, x) | x `elem` (",.!?" :: String) -> DocHyperlink (Hyperlink (decodeUtf8 xs) Nothing) `docAppend` DocString [x]+      Just (xs, x) | inClass ",.!?" x -> DocHyperlink (Hyperlink (decodeUtf8 xs) Nothing) `docAppend` DocString [x]       _ -> DocHyperlink (Hyperlink (decodeUtf8 s) Nothing)  -- | Parses strings between identifier delimiters. Consumes all input that it@@ -570,8 +570,13 @@ parseValid :: Parser String parseValid = p some   where-    idChar = satisfy (`elem` ("_.!#$%&*+/<=>?@\\|-~:^"::String))-             <|> digit <|> letter_ascii+    idChar =+      satisfy (\c -> isAlpha_ascii c+                     || isDigit c+                     -- N.B. '-' is placed first otherwise attoparsec thinks+                     -- it belongs to a character class+                     || inClass "-_.!#$%&*+/<=>?@\\|~:^" c)+     p p' = do       vs' <- p' $ utf8String "⋆" <|> return <$> idChar       let vs = concat vs'@@ -594,4 +599,4 @@   e <- idDelim   return $ DocIdentifier (o, vid, e)   where-    idDelim = char '\'' <|> char '`'+    idDelim = satisfy (\c -> c == '\'' || c == '`')
haddock-library/src/Documentation/Haddock/Parser/Util.hs view
@@ -22,7 +22,7 @@  import           Control.Applicative import           Control.Monad (mfilter)-import           Documentation.Haddock.Parser.Monad+import           Documentation.Haddock.Parser.Monad hiding (isHorizontalSpace) import           Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as BS import           Prelude hiding (takeWhile)@@ -40,11 +40,14 @@ strip :: String -> String strip = (\f -> f . f) $ dropWhile isSpace . reverse +isHorizontalSpace :: Char -> Bool+isHorizontalSpace = inClass " \t\f\v\r"+ skipHorizontalSpace :: Parser ()-skipHorizontalSpace = skipWhile (`elem` " \t\f\v\r")+skipHorizontalSpace = skipWhile isHorizontalSpace  takeHorizontalSpace :: Parser BS.ByteString-takeHorizontalSpace = takeWhile (`elem` " \t\f\v\r")+takeHorizontalSpace = takeWhile isHorizontalSpace  makeLabeled :: (String -> Maybe String -> a) -> String -> a makeLabeled f input = case break isSpace $ removeEscapes $ strip input of
haddock-library/src/Documentation/Haddock/Types.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-}+{-# LANGUAGE CPP, DeriveFunctor, DeriveFoldable, DeriveTraversable #-}  -- | -- Module      :  Documentation.Haddock.Types@@ -14,8 +14,10 @@ -- Exposes documentation data types used for (some) of Haddock. module Documentation.Haddock.Types where +#if !MIN_VERSION_base(4,8,0) import Data.Foldable import Data.Traversable+#endif  -- | With the advent of 'Version', we may want to start attaching more -- meta-data to comments. We make a structure for this ahead of time
− haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec.hs
@@ -1,23 +0,0 @@--- |--- Module      :  Data.Attoparsec--- Copyright   :  Bryan O'Sullivan 2007-2014--- License     :  BSD3------ Maintainer  :  bos@serpentine.com--- Stability   :  experimental--- Portability :  unknown------ Simple, efficient combinator parsing for--- 'Data.ByteString.ByteString' strings, loosely based on the Parsec--- library.------ This module is deprecated. Use "Data.Attoparsec.ByteString"--- instead.--module Data.Attoparsec-    {-# DEPRECATED "This module will be removed in the next major release." #-}-    (-      module Data.Attoparsec.ByteString-    ) where--import Data.Attoparsec.ByteString
− haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString.hs
@@ -1,223 +0,0 @@--- |--- Module      :  Data.Attoparsec.ByteString--- Copyright   :  Bryan O'Sullivan 2007-2014--- License     :  BSD3------ Maintainer  :  bos@serpentine.com--- Stability   :  experimental--- Portability :  unknown------ Simple, efficient combinator parsing for 'B.ByteString' strings,--- loosely based on the Parsec library.--module Data.Attoparsec.ByteString-    (-    -- * Differences from Parsec-    -- $parsec--    -- * Incremental input-    -- $incremental--    -- * Performance considerations-    -- $performance--    -- * Parser types-      I.Parser-    , Result-    , T.IResult(..)-    , I.compareResults--    -- * Running parsers-    , parse-    , feed-    , I.parseOnly-    , parseWith-    , parseTest--    -- ** Result conversion-    , maybeResult-    , eitherResult--    -- * Parsing individual bytes-    , I.word8-    , I.anyWord8-    , I.notWord8-    , I.satisfy-    , I.satisfyWith-    , I.skip--    -- ** Lookahead-    , I.peekWord8-    , I.peekWord8'--    -- ** Byte classes-    , I.inClass-    , I.notInClass--    -- * Efficient string handling-    , I.string-    , I.skipWhile-    , I.take-    , I.scan-    , I.takeWhile-    , I.takeWhile1-    , I.takeTill--    -- ** Consume all remaining input-    , I.takeByteString-    , I.takeLazyByteString--    -- * Combinators-    , try-    , (<?>)-    , choice-    , count-    , option-    , many'-    , many1-    , many1'-    , manyTill-    , manyTill'-    , sepBy-    , sepBy'-    , sepBy1-    , sepBy1'-    , skipMany-    , skipMany1-    , eitherP-    , I.match-    -- * State observation and manipulation functions-    , I.endOfInput-    , I.atEnd-    ) where--import Data.Attoparsec.Combinator-import qualified Data.Attoparsec.ByteString.Internal as I-import qualified Data.Attoparsec.Internal as I-import qualified Data.ByteString as B-import Data.Attoparsec.ByteString.Internal (Result, parse)-import qualified Data.Attoparsec.Internal.Types as T---- $parsec------ Compared to Parsec 3, attoparsec makes several tradeoffs.  It is--- not intended for, or ideal for, all possible uses.------ * While attoparsec can consume input incrementally, Parsec cannot.---   Incremental input is a huge deal for efficient and secure network---   and system programming, since it gives much more control to users---   of the library over matters such as resource usage and the I/O---   model to use.------ * Much of the performance advantage of attoparsec is gained via---   high-performance parsers such as 'I.takeWhile' and 'I.string'.---   If you use complicated combinators that return lists of bytes or---   characters, there is less performance difference between the two---   libraries.------ * Unlike Parsec 3, attoparsec does not support being used as a---   monad transformer.------ * attoparsec is specialised to deal only with strict 'B.ByteString'---   input.  Efficiency concerns rule out both lists and lazy---   bytestrings.  The usual use for lazy bytestrings would be to---   allow consumption of very large input without a large footprint.---   For this need, attoparsec's incremental input provides an---   excellent substitute, with much more control over when input---   takes place.  If you must use lazy bytestrings, see the---   "Data.Attoparsec.ByteString.Lazy" module, which feeds lazy chunks---   to a regular parser.------ * Parsec parsers can produce more helpful error messages than---   attoparsec parsers.  This is a matter of focus: attoparsec avoids---   the extra book-keeping in favour of higher performance.---- $incremental------ attoparsec supports incremental input, meaning that you can feed it--- a bytestring that represents only part of the expected total amount--- of data to parse. If your parser reaches the end of a fragment of--- input and could consume more input, it will suspend parsing and--- return a 'T.Partial' continuation.------ Supplying the 'T.Partial' continuation with a bytestring will--- resume parsing at the point where it was suspended, with the--- bytestring you supplied used as new input at the end of the--- existing input. You must be prepared for the result of the resumed--- parse to be another 'T.Partial' continuation.------ To indicate that you have no more input, supply the 'T.Partial'--- continuation with an empty bytestring.------ Remember that some parsing combinators will not return a result--- until they reach the end of input.  They may thus cause 'T.Partial'--- results to be returned.------ If you do not need support for incremental input, consider using--- the 'I.parseOnly' function to run your parser.  It will never--- prompt for more input.------ /Note/: incremental input does /not/ imply that attoparsec will--- release portions of its internal state for garbage collection as it--- proceeds.  Its internal representation is equivalent to a single--- 'ByteString': if you feed incremental input to a parser, it will--- require memory proportional to the amount of input you supply.--- (This is necessary to support arbitrary backtracking.)---- $performance------ If you write an attoparsec-based parser carefully, it can be--- realistic to expect it to perform similarly to a hand-rolled C--- parser (measuring megabytes parsed per second).------ To actually achieve high performance, there are a few guidelines--- that it is useful to follow.------ Use the 'B.ByteString'-oriented parsers whenever possible,--- e.g. 'I.takeWhile1' instead of 'many1' 'I.anyWord8'.  There is--- about a factor of 100 difference in performance between the two--- kinds of parser.------ For very simple byte-testing predicates, write them by hand instead--- of using 'I.inClass' or 'I.notInClass'.  For instance, both of--- these predicates test for an end-of-line byte, but the first is--- much faster than the second:------ >endOfLine_fast w = w == 13 || w == 10--- >endOfLine_slow   = inClass "\r\n"------ Make active use of benchmarking and profiling tools to measure,--- find the problems with, and improve the performance of your parser.---- | Run a parser and print its result to standard output.-parseTest :: (Show a) => I.Parser a -> B.ByteString -> IO ()-parseTest p s = print (parse p s)---- | Run a parser with an initial input string, and a monadic action--- that can supply more input if needed.-parseWith :: Monad m =>-             (m B.ByteString)-          -- ^ An action that will be executed to provide the parser-          -- with more input, if necessary.  The action must return an-          -- 'B.empty' string when there is no more input available.-          -> I.Parser a-          -> B.ByteString-          -- ^ Initial input for the parser.-          -> m (Result a)-parseWith refill p s = step $ parse p s-  where step (T.Partial k) = (step . k) =<< refill-        step r             = return r-{-# INLINE parseWith #-}---- | Convert a 'Result' value to a 'Maybe' value. A 'T.Partial' result--- is treated as failure.-maybeResult :: Result r -> Maybe r-maybeResult (T.Done _ r) = Just r-maybeResult _            = Nothing---- | Convert a 'Result' value to an 'Either' value. A 'T.Partial'--- result is treated as failure.-eitherResult :: Result r -> Either String r-eitherResult (T.Done _ r)     = Right r-eitherResult (T.Fail _ _ msg) = Left msg-eitherResult _                = Left "Result: incomplete input"
− haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString/Buffer.hs
@@ -1,151 +0,0 @@-{-# LANGUAGE BangPatterns #-}--- |--- Module      :  Data.Attoparsec.ByteString.Buffer--- Copyright   :  Bryan O'Sullivan 2007-2014--- License     :  BSD3------ Maintainer  :  bos@serpentine.com--- Stability   :  experimental--- Portability :  GHC------ An "immutable" buffer that supports cheap appends.------ A Buffer is divided into an immutable read-only zone, followed by a--- mutable area that we've preallocated, but not yet written to.------ We overallocate at the end of a Buffer so that we can cheaply--- append.  Since a user of an existing Buffer cannot see past the end--- of its immutable zone into the data that will change during an--- append, this is safe.------ Once we run out of space at the end of a Buffer, we do the usual--- doubling of the buffer size.------ The fact of having a mutable buffer really helps with performance,--- but it does have a consequence: if someone misuses the Partial API--- that attoparsec uses by calling the same continuation repeatedly--- (which never makes sense in practice), they could overwrite data.------ Since the API *looks* pure, it should *act* pure, too, so we use--- two generation counters (one mutable, one immutable) to track the--- number of appends to a mutable buffer. If the counters ever get out--- of sync, someone is appending twice to a mutable buffer, so we--- duplicate the entire buffer in order to preserve the immutability--- of its older self.------ While we could go a step further and gain protection against API--- abuse on a multicore system, by use of an atomic increment--- instruction to bump the mutable generation counter, that would be--- very expensive, and feels like it would also be in the realm of the--- ridiculous.  Clients should never call a continuation more than--- once; we lack a linear type system that could enforce this; and--- there's only so far we should go to accommodate broken uses.--module Data.Attoparsec.ByteString.Buffer-    (-      Buffer-    , buffer-    , unbuffer-    , pappend-    , length-    , unsafeIndex-    , substring-    , unsafeDrop-    ) where--import Control.Exception (assert)-import Data.ByteString.Internal (ByteString(..), memcpy, nullForeignPtr)-import Data.Attoparsec.Internal.Fhthagn (inlinePerformIO)-import Data.List (foldl1')-import Data.Monoid (Monoid(..))-import Data.Word (Word8)-import Foreign.ForeignPtr (ForeignPtr, withForeignPtr)-import Foreign.Ptr (castPtr, plusPtr)-import Foreign.Storable (peek, peekByteOff, poke, sizeOf)-import GHC.ForeignPtr (mallocPlainForeignPtrBytes)-import Prelude hiding (length)--data Buffer = Buf {-      _fp  :: {-# UNPACK #-} !(ForeignPtr Word8)-    , _off :: {-# UNPACK #-} !Int-    , _len :: {-# UNPACK #-} !Int-    , _cap :: {-# UNPACK #-} !Int-    , _gen :: {-# UNPACK #-} !Int-    }--instance Show Buffer where-    showsPrec p = showsPrec p . unbuffer---- | The initial 'Buffer' has no mutable zone, so we can avoid all--- copies in the (hopefully) common case of no further input being fed--- to us.-buffer :: ByteString -> Buffer-buffer (PS fp off len) = Buf fp off len len 0--unbuffer :: Buffer -> ByteString-unbuffer (Buf fp off len _ _) = PS fp off len--instance Monoid Buffer where-    mempty = Buf nullForeignPtr 0 0 0 0--    mappend (Buf _ _ _ 0 _) b        = b-    mappend a (Buf _ _ _ 0 _)        = a-    mappend buf (Buf fp off len _ _) = append buf fp off len--    mconcat [] = mempty-    mconcat xs = foldl1' mappend xs--pappend :: Buffer -> ByteString -> Buffer-pappend (Buf _ _ _ 0 _) (PS fp off len) = Buf fp off len 0 0-pappend buf (PS fp off len) = append buf fp off len--append :: Buffer -> ForeignPtr a -> Int -> Int -> Buffer-append (Buf fp0 off0 len0 cap0 gen0) !fp1 !off1 !len1 =-  inlinePerformIO . withForeignPtr fp0 $ \ptr0 ->-    withForeignPtr fp1 $ \ptr1 -> do-      let genSize = sizeOf (0::Int)-          newlen  = len0 + len1-      gen <- if gen0 == 0-             then return 0-             else peek (castPtr ptr0)-      if gen == gen0 && newlen <= cap0-        then do-          let newgen = gen + 1-          poke (castPtr ptr0) newgen-          memcpy (ptr0 `plusPtr` (off0+len0))-                 (ptr1 `plusPtr` off1)-                 (fromIntegral len1)-          return (Buf fp0 off0 newlen cap0 newgen)-        else do-          let newcap = newlen * 2-          fp <- mallocPlainForeignPtrBytes (newcap + genSize)-          withForeignPtr fp $ \ptr_ -> do-            let ptr    = ptr_ `plusPtr` genSize-                newgen = 1-            poke (castPtr ptr_) newgen-            memcpy ptr (ptr0 `plusPtr` off0) (fromIntegral len0)-            memcpy (ptr `plusPtr` len0) (ptr1 `plusPtr` off1)-                   (fromIntegral len1)-            return (Buf fp genSize newlen newcap newgen)--length :: Buffer -> Int-length (Buf _ _ len _ _) = len-{-# INLINE length #-}--unsafeIndex :: Buffer -> Int -> Word8-unsafeIndex (Buf fp off len _ _) i = assert (i >= 0 && i < len) .-    inlinePerformIO . withForeignPtr fp $ flip peekByteOff (off+i)-{-# INLINE unsafeIndex #-}--substring :: Int -> Int -> Buffer -> ByteString-substring s l (Buf fp off len _ _) =-  assert (s >= 0 && s <= len) .-  assert (l >= 0 && l <= len-s) $-  PS fp (off+s) l-{-# INLINE substring #-}--unsafeDrop :: Int -> Buffer -> ByteString-unsafeDrop s (Buf fp off len _ _) =-  assert (s >= 0 && s <= len) $-  PS fp (off+s) (len-s)-{-# INLINE unsafeDrop #-}
− haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString/Char8.hs
@@ -1,469 +0,0 @@-{-# LANGUAGE BangPatterns, FlexibleInstances, TypeFamilies,-    TypeSynonymInstances, GADTs #-}-{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-warnings-deprecations #-}---- |--- Module      :  Data.Attoparsec.ByteString.Char8--- Copyright   :  Bryan O'Sullivan 2007-2014--- License     :  BSD3------ Maintainer  :  bos@serpentine.com--- Stability   :  experimental--- Portability :  unknown------ Simple, efficient, character-oriented combinator parsing for--- 'B.ByteString' strings, loosely based on the Parsec library.--module Data.Attoparsec.ByteString.Char8-    (-    -- * Character encodings-    -- $encodings--    -- * Parser types-      Parser-    , A.Result-    , A.IResult(..)-    , I.compareResults--    -- * Running parsers-    , A.parse-    , A.feed-    , A.parseOnly-    , A.parseWith-    , A.parseTest--    -- ** Result conversion-    , A.maybeResult-    , A.eitherResult--    -- * Parsing individual characters-    , char-    , char8-    , anyChar-    , notChar-    , satisfy--    -- ** Lookahead-    , peekChar-    , peekChar'--    -- ** Special character parsers-    , digit-    , letter_iso8859_15-    , letter_ascii-    , space--    -- ** Fast predicates-    , isDigit-    , isDigit_w8-    , isAlpha_iso8859_15-    , isAlpha_ascii-    , isSpace-    , isSpace_w8--    -- *** Character classes-    , inClass-    , notInClass--    -- * Efficient string handling-    , I.string-    , stringCI-    , skipSpace-    , skipWhile-    , I.take-    , scan-    , takeWhile-    , takeWhile1-    , takeTill--    -- ** String combinators-    -- $specalt-    , (.*>)-    , (<*.)--    -- ** Consume all remaining input-    , I.takeByteString-    , I.takeLazyByteString--    -- * Text parsing-    , I.endOfLine-    , isEndOfLine-    , isHorizontalSpace--    -- * Numeric parsers-    , decimal-    , hexadecimal-    , signed-    , Number(..)--    -- * Combinators-    , try-    , (<?>)-    , choice-    , count-    , option-    , many'-    , many1-    , many1'-    , manyTill-    , manyTill'-    , sepBy-    , sepBy'-    , sepBy1-    , sepBy1'-    , skipMany-    , skipMany1-    , eitherP-    , I.match-    -- * State observation and manipulation functions-    , I.endOfInput-    , I.atEnd-    ) where--import Control.Applicative ((*>), (<*), (<$>), (<|>))-import Data.Attoparsec.ByteString.FastSet (charClass, memberChar)-import Data.Attoparsec.ByteString.Internal (Parser)-import Data.Attoparsec.Combinator-import Data.Attoparsec.Number (Number(..))-import Data.Bits (Bits, (.|.), shiftL)-import Data.ByteString.Internal (c2w, w2c)-import Data.Int (Int8, Int16, Int32, Int64)-import Data.String (IsString(..))-import Data.Word-import Prelude hiding (takeWhile)-import qualified Data.Attoparsec.ByteString as A-import qualified Data.Attoparsec.ByteString.Internal as I-import qualified Data.Attoparsec.Internal as I-import qualified Data.ByteString as B8-import qualified Data.ByteString.Char8 as B--instance (a ~ B.ByteString) => IsString (Parser a) where-    fromString = I.string . B.pack---- $encodings------ This module is intended for parsing text that is--- represented using an 8-bit character set, e.g. ASCII or--- ISO-8859-15.  It /does not/ make any attempt to deal with character--- encodings, multibyte characters, or wide characters.  In--- particular, all attempts to use characters above code point U+00FF--- will give wrong answers.------ Code points below U+0100 are simply translated to and from their--- numeric values, so e.g. the code point U+00A4 becomes the byte--- @0xA4@ (which is the Euro symbol in ISO-8859-15, but the generic--- currency sign in ISO-8859-1).  Haskell 'Char' values above U+00FF--- are truncated, so e.g. U+1D6B7 is truncated to the byte @0xB7@.---- ASCII-specific but fast, oh yes.-toLower :: Word8 -> Word8-toLower w | w >= 65 && w <= 90 = w + 32-          | otherwise          = w---- | Satisfy a literal string, ignoring case.-stringCI :: B.ByteString -> Parser B.ByteString-stringCI = I.stringTransform (B8.map toLower)-{-# INLINE stringCI #-}---- | Consume input as long as the predicate returns 'True', and return--- the consumed input.------ This parser requires the predicate to succeed on at least one byte--- of input: it will fail if the predicate never returns 'True' or if--- there is no input left.-takeWhile1 :: (Char -> Bool) -> Parser B.ByteString-takeWhile1 p = I.takeWhile1 (p . w2c)-{-# INLINE takeWhile1 #-}---- | The parser @satisfy p@ succeeds for any byte for which the--- predicate @p@ returns 'True'. Returns the byte that is actually--- parsed.------ >digit = satisfy isDigit--- >    where isDigit c = c >= '0' && c <= '9'-satisfy :: (Char -> Bool) -> Parser Char-satisfy = I.satisfyWith w2c-{-# INLINE satisfy #-}---- | Match a letter, in the ISO-8859-15 encoding.-letter_iso8859_15 :: Parser Char-letter_iso8859_15 = satisfy isAlpha_iso8859_15 <?> "letter_iso8859_15"-{-# INLINE letter_iso8859_15 #-}---- | Match a letter, in the ASCII encoding.-letter_ascii :: Parser Char-letter_ascii = satisfy isAlpha_ascii <?> "letter_ascii"-{-# INLINE letter_ascii #-}---- | A fast alphabetic predicate for the ISO-8859-15 encoding------ /Note/: For all character encodings other than ISO-8859-15, and--- almost all Unicode code points above U+00A3, this predicate gives--- /wrong answers/.-isAlpha_iso8859_15 :: Char -> Bool-isAlpha_iso8859_15 c = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||-                       (c >= '\166' && moby c)-  where moby = notInClass "\167\169\171-\179\182\183\185\187\191\215\247"-        {-# NOINLINE moby #-}-{-# INLINE isAlpha_iso8859_15 #-}---- | A fast alphabetic predicate for the ASCII encoding------ /Note/: For all character encodings other than ASCII, and--- almost all Unicode code points above U+007F, this predicate gives--- /wrong answers/.-isAlpha_ascii :: Char -> Bool-isAlpha_ascii c = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')-{-# INLINE isAlpha_ascii #-}---- | Parse a single digit.-digit :: Parser Char-digit = satisfy isDigit <?> "digit"-{-# INLINE digit #-}---- | A fast digit predicate.-isDigit :: Char -> Bool-isDigit c = c >= '0' && c <= '9'-{-# INLINE isDigit #-}---- | A fast digit predicate.-isDigit_w8 :: Word8 -> Bool-isDigit_w8 w = w >= 48 && w <= 57-{-# INLINE isDigit_w8 #-}---- | Match any character.-anyChar :: Parser Char-anyChar = satisfy $ const True-{-# INLINE anyChar #-}---- | Match any character, to perform lookahead. Returns 'Nothing' if--- end of input has been reached. Does not consume any input.------ /Note/: Because this parser does not fail, do not use it with--- combinators such as 'many', because such parsers loop until a--- failure occurs.  Careless use will thus result in an infinite loop.-peekChar :: Parser (Maybe Char)-peekChar = (fmap w2c) `fmap` I.peekWord8-{-# INLINE peekChar #-}---- | Match any character, to perform lookahead.  Does not consume any--- input, but will fail if end of input has been reached.-peekChar' :: Parser Char-peekChar' = w2c `fmap` I.peekWord8'-{-# INLINE peekChar' #-}---- | Fast predicate for matching ASCII space characters.------ /Note/: This predicate only gives correct answers for the ASCII--- encoding.  For instance, it does not recognise U+00A0 (non-breaking--- space) as a space character, even though it is a valid ISO-8859-15--- byte. For a Unicode-aware and only slightly slower predicate,--- use 'Data.Char.isSpace'-isSpace :: Char -> Bool-isSpace c = (c == ' ') || ('\t' <= c && c <= '\r')-{-# INLINE isSpace #-}---- | Fast 'Word8' predicate for matching ASCII space characters.-isSpace_w8 :: Word8 -> Bool-isSpace_w8 w = (w == 32) || (9 <= w && w <= 13)-{-# INLINE isSpace_w8 #-}----- | Parse a space character.------ /Note/: This parser only gives correct answers for the ASCII--- encoding.  For instance, it does not recognise U+00A0 (non-breaking--- space) as a space character, even though it is a valid ISO-8859-15--- byte.-space :: Parser Char-space = satisfy isSpace <?> "space"-{-# INLINE space #-}---- | Match a specific character.-char :: Char -> Parser Char-char c = satisfy (== c) <?> [c]-{-# INLINE char #-}---- | Match a specific character, but return its 'Word8' value.-char8 :: Char -> Parser Word8-char8 c = I.satisfy (== c2w c) <?> [c]-{-# INLINE char8 #-}---- | Match any character except the given one.-notChar :: Char -> Parser Char-notChar c = satisfy (/= c) <?> "not " ++ [c]-{-# INLINE notChar #-}---- | Match any character in a set.------ >vowel = inClass "aeiou"------ Range notation is supported.------ >halfAlphabet = inClass "a-nA-N"------ To add a literal \'-\' to a set, place it at the beginning or end--- of the string.-inClass :: String -> Char -> Bool-inClass s = (`memberChar` mySet)-    where mySet = charClass s-{-# INLINE inClass #-}---- | Match any character not in a set.-notInClass :: String -> Char -> Bool-notInClass s = not . inClass s-{-# INLINE notInClass #-}---- | Consume input as long as the predicate returns 'True', and return--- the consumed input.------ This parser does not fail.  It will return an empty string if the--- predicate returns 'False' on the first byte of input.------ /Note/: Because this parser does not fail, do not use it with--- combinators such as 'many', because such parsers loop until a--- failure occurs.  Careless use will thus result in an infinite loop.-takeWhile :: (Char -> Bool) -> Parser B.ByteString-takeWhile p = I.takeWhile (p . w2c)-{-# INLINE takeWhile #-}---- | A stateful scanner.  The predicate consumes and transforms a--- state argument, and each transformed state is passed to successive--- invocations of the predicate on each byte of the input until one--- returns 'Nothing' or the input ends.------ This parser does not fail.  It will return an empty string if the--- predicate returns 'Nothing' on the first byte of input.------ /Note/: Because this parser does not fail, do not use it with--- combinators such as 'many', because such parsers loop until a--- failure occurs.  Careless use will thus result in an infinite loop.-scan :: s -> (s -> Char -> Maybe s) -> Parser B.ByteString-scan s0 p = I.scan s0 (\s -> p s . w2c)-{-# INLINE scan #-}---- | Consume input as long as the predicate returns 'False'--- (i.e. until it returns 'True'), and return the consumed input.------ This parser does not fail.  It will return an empty string if the--- predicate returns 'True' on the first byte of input.------ /Note/: Because this parser does not fail, do not use it with--- combinators such as 'many', because such parsers loop until a--- failure occurs.  Careless use will thus result in an infinite loop.-takeTill :: (Char -> Bool) -> Parser B.ByteString-takeTill p = I.takeTill (p . w2c)-{-# INLINE takeTill #-}---- | Skip past input for as long as the predicate returns 'True'.-skipWhile :: (Char -> Bool) -> Parser ()-skipWhile p = I.skipWhile (p . w2c)-{-# INLINE skipWhile #-}---- | Skip over white space.-skipSpace :: Parser ()-skipSpace = I.skipWhile isSpace_w8-{-# INLINE skipSpace #-}---- $specalt------ If you enable the @OverloadedStrings@ language extension, you can--- use the '*>' and '<*' combinators to simplify the common task of--- matching a statically known string, then immediately parsing--- something else.------ Instead of writing something like this:------ @---'I.string' \"foo\" '*>' wibble--- @------ Using @OverloadedStrings@, you can omit the explicit use of--- 'I.string', and write a more compact version:------ @--- \"foo\" '*>' wibble--- @------ (Note: the '.*>' and '<*.' combinators that were originally--- provided for this purpose are obsolete and unnecessary, and will be--- removed in the next major version.)---- | /Obsolete/. A type-specialized version of '*>' for--- 'B.ByteString'. Use '*>' instead.-(.*>) :: B.ByteString -> Parser a -> Parser a-s .*> f = I.string s *> f-{-# DEPRECATED (.*>) "This is no longer necessary, and will be removed. Use '*>' instead." #-}---- | /Obsolete/. A type-specialized version of '<*' for--- 'B.ByteString'. Use '<*' instead.-(<*.) :: Parser a -> B.ByteString -> Parser a-f <*. s = f <* I.string s-{-# DEPRECATED (<*.) "This is no longer necessary, and will be removed. Use '<*' instead." #-}---- | A predicate that matches either a carriage return @\'\\r\'@ or--- newline @\'\\n\'@ character.-isEndOfLine :: Word8 -> Bool-isEndOfLine w = w == 13 || w == 10-{-# INLINE isEndOfLine #-}---- | A predicate that matches either a space @\' \'@ or horizontal tab--- @\'\\t\'@ character.-isHorizontalSpace :: Word8 -> Bool-isHorizontalSpace w = w == 32 || w == 9-{-# INLINE isHorizontalSpace #-}---- | Parse and decode an unsigned hexadecimal number.  The hex digits--- @\'a\'@ through @\'f\'@ may be upper or lower case.------ This parser does not accept a leading @\"0x\"@ string.-hexadecimal :: (Integral a, Bits a) => Parser a-hexadecimal = B8.foldl' step 0 `fmap` I.takeWhile1 isHexDigit-  where-    isHexDigit w = (w >= 48 && w <= 57) ||-                   (w >= 97 && w <= 102) ||-                   (w >= 65 && w <= 70)-    step a w | w >= 48 && w <= 57  = (a `shiftL` 4) .|. fromIntegral (w - 48)-             | w >= 97             = (a `shiftL` 4) .|. fromIntegral (w - 87)-             | otherwise           = (a `shiftL` 4) .|. fromIntegral (w - 55)-{-# SPECIALISE hexadecimal :: Parser Int #-}-{-# SPECIALISE hexadecimal :: Parser Int8 #-}-{-# SPECIALISE hexadecimal :: Parser Int16 #-}-{-# SPECIALISE hexadecimal :: Parser Int32 #-}-{-# SPECIALISE hexadecimal :: Parser Int64 #-}-{-# SPECIALISE hexadecimal :: Parser Integer #-}-{-# SPECIALISE hexadecimal :: Parser Word #-}-{-# SPECIALISE hexadecimal :: Parser Word8 #-}-{-# SPECIALISE hexadecimal :: Parser Word16 #-}-{-# SPECIALISE hexadecimal :: Parser Word32 #-}-{-# SPECIALISE hexadecimal :: Parser Word64 #-}---- | Parse and decode an unsigned decimal number.-decimal :: Integral a => Parser a-decimal = B8.foldl' step 0 `fmap` I.takeWhile1 isDig-  where isDig w  = w >= 48 && w <= 57-        step a w = a * 10 + fromIntegral (w - 48)-{-# SPECIALISE decimal :: Parser Int #-}-{-# SPECIALISE decimal :: Parser Int8 #-}-{-# SPECIALISE decimal :: Parser Int16 #-}-{-# SPECIALISE decimal :: Parser Int32 #-}-{-# SPECIALISE decimal :: Parser Int64 #-}-{-# SPECIALISE decimal :: Parser Integer #-}-{-# SPECIALISE decimal :: Parser Word #-}-{-# SPECIALISE decimal :: Parser Word8 #-}-{-# SPECIALISE decimal :: Parser Word16 #-}-{-# SPECIALISE decimal :: Parser Word32 #-}-{-# SPECIALISE decimal :: Parser Word64 #-}---- | Parse a number with an optional leading @\'+\'@ or @\'-\'@ sign--- character.-signed :: Num a => Parser a -> Parser a-{-# SPECIALISE signed :: Parser Int -> Parser Int #-}-{-# SPECIALISE signed :: Parser Int8 -> Parser Int8 #-}-{-# SPECIALISE signed :: Parser Int16 -> Parser Int16 #-}-{-# SPECIALISE signed :: Parser Int32 -> Parser Int32 #-}-{-# SPECIALISE signed :: Parser Int64 -> Parser Int64 #-}-{-# SPECIALISE signed :: Parser Integer -> Parser Integer #-}-signed p = (negate <$> (char8 '-' *> p))-       <|> (char8 '+' *> p)-       <|> p
− haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString/FastSet.hs
@@ -1,115 +0,0 @@-{-# LANGUAGE BangPatterns, MagicHash #-}---------------------------------------------------------------------------------- |--- Module      :  Data.Attoparsec.ByteString.FastSet--- Copyright   :  Bryan O'Sullivan 2007-2014--- License     :  BSD3------ Maintainer  :  bos@serpentine.com--- Stability   :  experimental--- Portability :  unknown------ Fast set membership tests for 'Word8' and 8-bit 'Char' values.  The--- set representation is unboxed for efficiency.  For small sets, we--- test for membership using a binary search.  For larger sets, we use--- a lookup table.----------------------------------------------------------------------------------module Data.Attoparsec.ByteString.FastSet-    (-    -- * Data type-      FastSet-    -- * Construction-    , fromList-    , set-    -- * Lookup-    , memberChar-    , memberWord8-    -- * Debugging-    , fromSet-    -- * Handy interface-    , charClass-    ) where--import Data.Bits ((.&.), (.|.))-import Foreign.Storable (peekByteOff, pokeByteOff)-import GHC.Base (Int(I#), iShiftRA#, narrow8Word#, shiftL#)-import GHC.Word (Word8(W8#))-import qualified Data.ByteString as B-import qualified Data.ByteString.Char8 as B8-import qualified Data.ByteString.Internal as I-import qualified Data.ByteString.Unsafe as U--data FastSet = Sorted { fromSet :: !B.ByteString }-             | Table  { fromSet :: !B.ByteString }-    deriving (Eq, Ord)--instance Show FastSet where-    show (Sorted s) = "FastSet Sorted " ++ show (B8.unpack s)-    show (Table _) = "FastSet Table"---- | The lower bound on the size of a lookup table.  We choose this to--- balance table density against performance.-tableCutoff :: Int-tableCutoff = 8---- | Create a set.-set :: B.ByteString -> FastSet-set s | B.length s < tableCutoff = Sorted . B.sort $ s-      | otherwise                = Table . mkTable $ s--fromList :: [Word8] -> FastSet-fromList = set . B.pack--data I = I {-# UNPACK #-} !Int {-# UNPACK #-} !Word8--shiftR :: Int -> Int -> Int-shiftR (I# x#) (I# i#) = I# (x# `iShiftRA#` i#)--shiftL :: Word8 -> Int -> Word8-shiftL (W8# x#) (I# i#) = W8# (narrow8Word# (x# `shiftL#` i#))--index :: Int -> I-index i = I (i `shiftR` 3) (1 `shiftL` (i .&. 7))-{-# INLINE index #-}---- | Check the set for membership.-memberWord8 :: Word8 -> FastSet -> Bool-memberWord8 w (Table t)  =-    let I byte bit = index (fromIntegral w)-    in  U.unsafeIndex t byte .&. bit /= 0-memberWord8 w (Sorted s) = search 0 (B.length s - 1)-    where search lo hi-              | hi < lo = False-              | otherwise =-                  let mid = (lo + hi) `quot` 2-                  in case compare w (U.unsafeIndex s mid) of-                       GT -> search (mid + 1) hi-                       LT -> search lo (mid - 1)-                       _ -> True---- | Check the set for membership.  Only works with 8-bit characters:--- characters above code point 255 will give wrong answers.-memberChar :: Char -> FastSet -> Bool-memberChar c = memberWord8 (I.c2w c)-{-# INLINE memberChar #-}--mkTable :: B.ByteString -> B.ByteString-mkTable s = I.unsafeCreate 32 $ \t -> do-            _ <- I.memset t 0 32-            U.unsafeUseAsCStringLen s $ \(p, l) ->-              let loop n | n == l = return ()-                         | otherwise = do-                    c <- peekByteOff p n :: IO Word8-                    let I byte bit = index (fromIntegral c)-                    prev <- peekByteOff t byte :: IO Word8-                    pokeByteOff t byte (prev .|. bit)-                    loop (n + 1)-              in loop 0--charClass :: String -> FastSet-charClass = set . B8.pack . go-    where go (a:'-':b:xs) = [a..b] ++ go xs-          go (x:xs) = x : go xs-          go _ = ""
− haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString/Internal.hs
@@ -1,485 +0,0 @@-{-# LANGUAGE BangPatterns, GADTs, OverloadedStrings, RecordWildCards #-}--- |--- Module      :  Data.Attoparsec.ByteString.Internal--- Copyright   :  Bryan O'Sullivan 2007-2014--- License     :  BSD3------ Maintainer  :  bos@serpentine.com--- Stability   :  experimental--- Portability :  unknown------ Simple, efficient parser combinators for 'ByteString' strings,--- loosely based on the Parsec library.--module Data.Attoparsec.ByteString.Internal-    (-    -- * Parser types-      Parser-    , Result--    -- * Running parsers-    , parse-    , parseOnly--    -- * Combinators-    , module Data.Attoparsec.Combinator--    -- * Parsing individual bytes-    , satisfy-    , satisfyWith-    , anyWord8-    , skip-    , word8-    , notWord8--    -- ** Lookahead-    , peekWord8-    , peekWord8'--    -- ** Byte classes-    , inClass-    , notInClass--    -- * Parsing more complicated structures-    , storable--    -- * Efficient string handling-    , skipWhile-    , string-    , stringTransform-    , take-    , scan-    , runScanner-    , takeWhile-    , takeWhile1-    , takeTill--    -- ** Consume all remaining input-    , takeByteString-    , takeLazyByteString--    -- * Utilities-    , endOfLine-    , endOfInput-    , match-    , atEnd-    ) where--import Control.Applicative ((<|>), (<$>))-import Control.Monad (when)-import Data.Attoparsec.ByteString.Buffer (Buffer, buffer)-import Data.Attoparsec.ByteString.FastSet (charClass, memberWord8)-import Data.Attoparsec.Combinator ((<?>))-import Data.Attoparsec.Internal-import Data.Attoparsec.Internal.Fhthagn (inlinePerformIO)-import Data.Attoparsec.Internal.Types hiding (Parser, Failure, Success)-import Data.ByteString (ByteString)-import Data.Word (Word8)-import Foreign.ForeignPtr (withForeignPtr)-import Foreign.Ptr (castPtr, minusPtr, plusPtr)-import Foreign.Storable (Storable(peek, sizeOf))-import Prelude hiding (getChar, succ, take, takeWhile)-import qualified Data.Attoparsec.ByteString.Buffer as Buf-import qualified Data.Attoparsec.Internal.Types as T-import qualified Data.ByteString as B8-import qualified Data.ByteString.Char8 as B-import qualified Data.ByteString.Internal as B-import qualified Data.ByteString.Lazy as L-import qualified Data.ByteString.Unsafe as B--type Parser = T.Parser ByteString-type Result = IResult ByteString-type Failure r = T.Failure ByteString Buffer r-type Success a r = T.Success ByteString Buffer a r---- | The parser @satisfy p@ succeeds for any byte for which the--- predicate @p@ returns 'True'. Returns the byte that is actually--- parsed.------ >digit = satisfy isDigit--- >    where isDigit w = w >= 48 && w <= 57-satisfy :: (Word8 -> Bool) -> Parser Word8-satisfy p = do-  h <- peekWord8'-  if p h-    then advance 1 >> return h-    else fail "satisfy"-{-# INLINE satisfy #-}---- | The parser @skip p@ succeeds for any byte for which the predicate--- @p@ returns 'True'.------ >skipDigit = skip isDigit--- >    where isDigit w = w >= 48 && w <= 57-skip :: (Word8 -> Bool) -> Parser ()-skip p = do-  h <- peekWord8'-  if p h-    then advance 1-    else fail "skip"---- | The parser @satisfyWith f p@ transforms a byte, and succeeds if--- the predicate @p@ returns 'True' on the transformed value. The--- parser returns the transformed byte that was parsed.-satisfyWith :: (Word8 -> a) -> (a -> Bool) -> Parser a-satisfyWith f p = do-  h <- peekWord8'-  let c = f h-  if p c-    then advance 1 >> return c-    else fail "satisfyWith"-{-# INLINE satisfyWith #-}--storable :: Storable a => Parser a-storable = hack undefined- where-  hack :: Storable b => b -> Parser b-  hack dummy = do-    (fp,o,_) <- B.toForeignPtr `fmap` take (sizeOf dummy)-    return . B.inlinePerformIO . withForeignPtr fp $ \p ->-        peek (castPtr $ p `plusPtr` o)---- | Consume @n@ bytes of input, but succeed only if the predicate--- returns 'True'.-takeWith :: Int -> (ByteString -> Bool) -> Parser ByteString-takeWith n0 p = do-  let n = max n0 0-  s <- ensure n-  if p s-    then advance n >> return s-    else fail "takeWith"---- | Consume exactly @n@ bytes of input.-take :: Int -> Parser ByteString-take n = takeWith n (const True)-{-# INLINE take #-}---- | @string s@ parses a sequence of bytes that identically match--- @s@. Returns the parsed string (i.e. @s@).  This parser consumes no--- input if it fails (even if a partial match).------ /Note/: The behaviour of this parser is different to that of the--- similarly-named parser in Parsec, as this one is all-or-nothing.--- To illustrate the difference, the following parser will fail under--- Parsec given an input of @\"for\"@:------ >string "foo" <|> string "for"------ The reason for its failure is that the first branch is a--- partial match, and will consume the letters @\'f\'@ and @\'o\'@--- before failing.  In attoparsec, the above parser will /succeed/ on--- that input, because the failed first branch will consume nothing.-string :: ByteString -> Parser ByteString-string s = takeWith (B.length s) (==s)-{-# INLINE string #-}--stringTransform :: (ByteString -> ByteString) -> ByteString-                -> Parser ByteString-stringTransform f s = takeWith (B.length s) ((==f s) . f)-{-# INLINE stringTransform #-}---- | Skip past input for as long as the predicate returns 'True'.-skipWhile :: (Word8 -> Bool) -> Parser ()-skipWhile p = go- where-  go = do-    t <- B8.takeWhile p <$> get-    continue <- inputSpansChunks (B.length t)-    when continue go-{-# INLINE skipWhile #-}---- | Consume input as long as the predicate returns 'False'--- (i.e. until it returns 'True'), and return the consumed input.------ This parser does not fail.  It will return an empty string if the--- predicate returns 'True' on the first byte of input.------ /Note/: Because this parser does not fail, do not use it with--- combinators such as 'Control.Applicative.many', because such--- parsers loop until a failure occurs.  Careless use will thus result--- in an infinite loop.-takeTill :: (Word8 -> Bool) -> Parser ByteString-takeTill p = takeWhile (not . p)-{-# INLINE takeTill #-}---- | Consume input as long as the predicate returns 'True', and return--- the consumed input.------ This parser does not fail.  It will return an empty string if the--- predicate returns 'False' on the first byte of input.------ /Note/: Because this parser does not fail, do not use it with--- combinators such as 'Control.Applicative.many', because such--- parsers loop until a failure occurs.  Careless use will thus result--- in an infinite loop.-takeWhile :: (Word8 -> Bool) -> Parser ByteString-takeWhile p = (B.concat . reverse) `fmap` go []- where-  go acc = do-    s <- B8.takeWhile p <$> get-    continue <- inputSpansChunks (B.length s)-    if continue-      then go (s:acc)-      else return (s:acc)-{-# INLINE takeWhile #-}--takeRest :: Parser [ByteString]-takeRest = go []- where-  go acc = do-    input <- wantInput-    if input-      then do-        s <- get-        advance (B.length s)-        go (s:acc)-      else return (reverse acc)---- | Consume all remaining input and return it as a single string.-takeByteString :: Parser ByteString-takeByteString = B.concat `fmap` takeRest---- | Consume all remaining input and return it as a single string.-takeLazyByteString :: Parser L.ByteString-takeLazyByteString = L.fromChunks `fmap` takeRest--data T s = T {-# UNPACK #-} !Int s--scan_ :: (s -> [ByteString] -> Parser r) -> s -> (s -> Word8 -> Maybe s)-         -> Parser r-scan_ f s0 p = go [] s0- where-  go acc s1 = do-    let scanner (B.PS fp off len) =-          withForeignPtr fp $ \ptr0 -> do-            let start = ptr0 `plusPtr` off-                end   = start `plusPtr` len-                inner ptr !s-                  | ptr < end = do-                    w <- peek ptr-                    case p s w of-                      Just s' -> inner (ptr `plusPtr` 1) s'-                      _       -> done (ptr `minusPtr` start) s-                  | otherwise = done (ptr `minusPtr` start) s-                done !i !s = return (T i s)-            inner start s1-    bs <- get-    let T i s' = inlinePerformIO $ scanner bs-        !h = B.unsafeTake i bs-    continue <- inputSpansChunks i-    if continue-      then go (h:acc) s'-      else f s' (h:acc)-{-# INLINE scan_ #-}---- | A stateful scanner.  The predicate consumes and transforms a--- state argument, and each transformed state is passed to successive--- invocations of the predicate on each byte of the input until one--- returns 'Nothing' or the input ends.------ This parser does not fail.  It will return an empty string if the--- predicate returns 'Nothing' on the first byte of input.------ /Note/: Because this parser does not fail, do not use it with--- combinators such as 'Control.Applicative.many', because such--- parsers loop until a failure occurs.  Careless use will thus result--- in an infinite loop.-scan :: s -> (s -> Word8 -> Maybe s) -> Parser ByteString-scan = scan_ $ \_ chunks ->-  case chunks of-    [x] -> return x-    xs  -> return $! B.concat $ reverse xs-{-# INLINE scan #-}---- | Like 'scan', but generalized to return the final state of the--- scanner.-runScanner :: s -> (s -> Word8 -> Maybe s) -> Parser (ByteString, s)-runScanner = scan_ $ \s xs -> return (B.concat (reverse xs), s)-{-# INLINE runScanner #-}---- | Consume input as long as the predicate returns 'True', and return--- the consumed input.------ This parser requires the predicate to succeed on at least one byte--- of input: it will fail if the predicate never returns 'True' or if--- there is no input left.-takeWhile1 :: (Word8 -> Bool) -> Parser ByteString-takeWhile1 p = do-  (`when` demandInput) =<< endOfChunk-  s <- B8.takeWhile p <$> get-  let len = B.length s-  if len == 0-    then fail "takeWhile1"-    else do-      advance len-      eoc <- endOfChunk-      if eoc-        then (s<>) `fmap` takeWhile p-        else return s---- | Match any byte in a set.------ >vowel = inClass "aeiou"------ Range notation is supported.------ >halfAlphabet = inClass "a-nA-N"------ To add a literal @\'-\'@ to a set, place it at the beginning or end--- of the string.-inClass :: String -> Word8 -> Bool-inClass s = (`memberWord8` mySet)-    where mySet = charClass s-          {-# NOINLINE mySet #-}-{-# INLINE inClass #-}---- | Match any byte not in a set.-notInClass :: String -> Word8 -> Bool-notInClass s = not . inClass s-{-# INLINE notInClass #-}---- | Match any byte.-anyWord8 :: Parser Word8-anyWord8 = satisfy $ const True-{-# INLINE anyWord8 #-}---- | Match a specific byte.-word8 :: Word8 -> Parser Word8-word8 c = satisfy (== c) <?> show c-{-# INLINE word8 #-}---- | Match any byte except the given one.-notWord8 :: Word8 -> Parser Word8-notWord8 c = satisfy (/= c) <?> "not " ++ show c-{-# INLINE notWord8 #-}---- | Match any byte, to perform lookahead. Returns 'Nothing' if end of--- input has been reached. Does not consume any input.------ /Note/: Because this parser does not fail, do not use it with--- combinators such as 'Control.Applicative.many', because such--- parsers loop until a failure occurs.  Careless use will thus result--- in an infinite loop.-peekWord8 :: Parser (Maybe Word8)-peekWord8 = T.Parser $ \t pos@(Pos pos_) more _lose succ ->-  case () of-    _| pos_ < Buf.length t ->-       let !w = Buf.unsafeIndex t pos_-       in succ t pos more (Just w)-     | more == Complete ->-       succ t pos more Nothing-     | otherwise ->-       let succ' t' pos' more' = let !w = Buf.unsafeIndex t' pos_-                                 in succ t' pos' more' (Just w)-           lose' t' pos' more' = succ t' pos' more' Nothing-       in prompt t pos more lose' succ'-{-# INLINE peekWord8 #-}---- | Match any byte, to perform lookahead.  Does not consume any--- input, but will fail if end of input has been reached.-peekWord8' :: Parser Word8-peekWord8' = T.Parser $ \t pos more lose succ ->-    if lengthAtLeast pos 1 t-    then succ t pos more (Buf.unsafeIndex t (fromPos pos))-    else let succ' t' pos' more' bs' = succ t' pos' more' $! B.unsafeHead bs'-         in ensureSuspended 1 t pos more lose succ'-{-# INLINE peekWord8' #-}---- | Match either a single newline character @\'\\n\'@, or a carriage--- return followed by a newline character @\"\\r\\n\"@.-endOfLine :: Parser ()-endOfLine = (word8 10 >> return ()) <|> (string "\r\n" >> return ())---- | Terminal failure continuation.-failK :: Failure a-failK t (Pos pos) _more stack msg = Fail (Buf.unsafeDrop pos t) stack msg-{-# INLINE failK #-}---- | Terminal success continuation.-successK :: Success a a-successK t (Pos pos) _more a = Done (Buf.unsafeDrop pos t) a-{-# INLINE successK #-}---- | Run a parser.-parse :: Parser a -> ByteString -> Result a-parse m s = T.runParser m (buffer s) (Pos 0) Incomplete failK successK-{-# INLINE parse #-}---- | Run a parser that cannot be resupplied via a 'Partial' result.------ This function does not force a parser to consume all of its input.--- Instead, any residual input will be discarded.  To force a parser--- to consume all of its input, use something like this:------ @---'parseOnly' (myParser 'Control.Applicative.<*' 'endOfInput')--- @-parseOnly :: Parser a -> ByteString -> Either String a-parseOnly m s = case T.runParser m (buffer s) (Pos 0) Complete failK successK of-                  Fail _ _ err -> Left err-                  Done _ a     -> Right a-                  _            -> error "parseOnly: impossible error!"-{-# INLINE parseOnly #-}--get :: Parser ByteString-get = T.Parser $ \t pos more _lose succ ->-  succ t pos more (Buf.unsafeDrop (fromPos pos) t)-{-# INLINE get #-}--endOfChunk :: Parser Bool-endOfChunk = T.Parser $ \t pos more _lose succ ->-  succ t pos more (fromPos pos == Buf.length t)-{-# INLINE endOfChunk #-}--inputSpansChunks :: Int -> Parser Bool-inputSpansChunks i = T.Parser $ \t pos_ more _lose succ ->-  let pos = pos_ + Pos i-  in if fromPos pos < Buf.length t || more == Complete-     then succ t pos more False-     else let lose' t' pos' more' = succ t' pos' more' False-              succ' t' pos' more' = succ t' pos' more' True-          in prompt t pos more lose' succ'-{-# INLINE inputSpansChunks #-}--advance :: Int -> Parser ()-advance n = T.Parser $ \t pos more _lose succ ->-  succ t (pos + Pos n) more ()-{-# INLINE advance #-}--ensureSuspended :: Int -> Buffer -> Pos -> More-                -> Failure r-                -> Success ByteString r-                -> Result r-ensureSuspended n t pos more lose succ =-    runParser (demandInput >> go) t pos more lose succ-  where go = T.Parser $ \t' pos' more' lose' succ' ->-          if lengthAtLeast pos' n t'-          then succ' t' pos' more' (substring pos (Pos n) t')-          else runParser (demandInput >> go) t' pos' more' lose' succ'---- | If at least @n@ elements of input are available, return the--- current input, otherwise fail.-ensure :: Int -> Parser ByteString-ensure n = T.Parser $ \t pos more lose succ ->-    if lengthAtLeast pos n t-    then succ t pos more (substring pos (Pos n) t)-    -- The uncommon case is kept out-of-line to reduce code size:-    else ensureSuspended n t pos more lose succ--- Non-recursive so the bounds check can be inlined:-{-# INLINE ensure #-}---- | Return both the result of a parse and the portion of the input--- that was consumed while it was being parsed.-match :: Parser a -> Parser (ByteString, a)-match p = T.Parser $ \t pos more lose succ ->-  let succ' t' pos' more' a =-        succ t' pos' more' (substring pos (pos'-pos) t', a)-  in runParser p t pos more lose succ'--lengthAtLeast :: Pos -> Int -> Buffer -> Bool-lengthAtLeast (Pos pos) n bs = Buf.length bs >= pos + n-{-# INLINE lengthAtLeast #-}--substring :: Pos -> Pos -> Buffer -> ByteString-substring (Pos pos) (Pos n) = Buf.substring pos n-{-# INLINE substring #-}
− haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Combinator.hs
@@ -1,220 +0,0 @@-{-# LANGUAGE BangPatterns #-}--- |--- Module      :  Data.Attoparsec.Combinator--- Copyright   :  Daan Leijen 1999-2001, Bryan O'Sullivan 2007-2014--- License     :  BSD3------ Maintainer  :  bos@serpentine.com--- Stability   :  experimental--- Portability :  portable------ Useful parser combinators, similar to those provided by Parsec.-module Data.Attoparsec.Combinator-    (-    -- * Combinators-      try-    , (<?>)-    , choice-    , count-    , option-    , many'-    , many1-    , many1'-    , manyTill-    , manyTill'-    , sepBy-    , sepBy'-    , sepBy1-    , sepBy1'-    , skipMany-    , skipMany1-    , eitherP-    , feed-    , satisfyElem-    , endOfInput-    , atEnd-    ) where--import Control.Applicative (Alternative(..), Applicative(..), empty, liftA2,-                            many, (<|>), (*>), (<$>))-import Control.Monad (MonadPlus(..))-import Data.Attoparsec.Internal.Types (Parser(..), IResult(..))-import Data.Attoparsec.Internal (endOfInput, atEnd, satisfyElem)-import Data.ByteString (ByteString)-import Data.Monoid (Monoid(mappend))-import Prelude hiding (succ)---- | Attempt a parse, and if it fails, rewind the input so that no--- input appears to have been consumed.------ This combinator is provided for compatibility with Parsec.--- attoparsec parsers always backtrack on failure.-try :: Parser i a -> Parser i a-try p = p-{-# INLINE try #-}---- | Name the parser, in case failure occurs.-(<?>) :: Parser i a-      -> String                 -- ^ the name to use if parsing fails-      -> Parser i a-p <?> msg0 = Parser $ \t pos more lose succ ->-             let lose' t' pos' more' strs msg = lose t' pos' more' (msg0:strs) msg-             in runParser p t pos more lose' succ-{-# INLINE (<?>) #-}-infix 0 <?>---- | @choice ps@ tries to apply the actions in the list @ps@ in order,--- until one of them succeeds. Returns the value of the succeeding--- action.-choice :: Alternative f => [f a] -> f a-choice = foldr (<|>) empty-{-# SPECIALIZE choice :: [Parser ByteString a]-                      -> Parser ByteString a #-}---- | @option x p@ tries to apply action @p@. If @p@ fails without--- consuming input, it returns the value @x@, otherwise the value--- returned by @p@.------ > priority  = option 0 (digitToInt <$> digit)-option :: Alternative f => a -> f a -> f a-option x p = p <|> pure x-{-# SPECIALIZE option :: a -> Parser ByteString a -> Parser ByteString a #-}---- | A version of 'liftM2' that is strict in the result of its first--- action.-liftM2' :: (Monad m) => (a -> b -> c) -> m a -> m b -> m c-liftM2' f a b = do-  !x <- a-  y <- b-  return (f x y)-{-# INLINE liftM2' #-}---- | @many' p@ applies the action @p@ /zero/ or more times. Returns a--- list of the returned values of @p@. The value returned by @p@ is--- forced to WHNF.------ >  word  = many' letter-many' :: (MonadPlus m) => m a -> m [a]-many' p = many_p-  where many_p = some_p `mplus` return []-        some_p = liftM2' (:) p many_p-{-# INLINE many' #-}---- | @many1 p@ applies the action @p@ /one/ or more times. Returns a--- list of the returned values of @p@.------ >  word  = many1 letter-many1 :: Alternative f => f a -> f [a]-many1 p = liftA2 (:) p (many p)-{-# INLINE many1 #-}---- | @many1' p@ applies the action @p@ /one/ or more times. Returns a--- list of the returned values of @p@. The value returned by @p@ is--- forced to WHNF.------ >  word  = many1' letter-many1' :: (MonadPlus m) => m a -> m [a]-many1' p = liftM2' (:) p (many' p)-{-# INLINE many1' #-}---- | @sepBy p sep@ applies /zero/ or more occurrences of @p@, separated--- by @sep@. Returns a list of the values returned by @p@.------ > commaSep p  = p `sepBy` (symbol ",")-sepBy :: Alternative f => f a -> f s -> f [a]-sepBy p s = liftA2 (:) p ((s *> sepBy1 p s) <|> pure []) <|> pure []-{-# SPECIALIZE sepBy :: Parser ByteString a -> Parser ByteString s-                     -> Parser ByteString [a] #-}---- | @sepBy' p sep@ applies /zero/ or more occurrences of @p@, separated--- by @sep@. Returns a list of the values returned by @p@. The value--- returned by @p@ is forced to WHNF.------ > commaSep p  = p `sepBy'` (symbol ",")-sepBy' :: (MonadPlus m) => m a -> m s -> m [a]-sepBy' p s = scan `mplus` return []-  where scan = liftM2' (:) p ((s >> sepBy1' p s) `mplus` return [])-{-# SPECIALIZE sepBy' :: Parser ByteString a -> Parser ByteString s-                      -> Parser ByteString [a] #-}---- | @sepBy1 p sep@ applies /one/ or more occurrences of @p@, separated--- by @sep@. Returns a list of the values returned by @p@.------ > commaSep p  = p `sepBy1` (symbol ",")-sepBy1 :: Alternative f => f a -> f s -> f [a]-sepBy1 p s = scan-    where scan = liftA2 (:) p ((s *> scan) <|> pure [])-{-# SPECIALIZE sepBy1 :: Parser ByteString a -> Parser ByteString s-                      -> Parser ByteString [a] #-}---- | @sepBy1' p sep@ applies /one/ or more occurrences of @p@, separated--- by @sep@. Returns a list of the values returned by @p@. The value--- returned by @p@ is forced to WHNF.------ > commaSep p  = p `sepBy1'` (symbol ",")-sepBy1' :: (MonadPlus m) => m a -> m s -> m [a]-sepBy1' p s = scan-    where scan = liftM2' (:) p ((s >> scan) `mplus` return [])-{-# SPECIALIZE sepBy1' :: Parser ByteString a -> Parser ByteString s-                       -> Parser ByteString [a] #-}---- | @manyTill p end@ applies action @p@ /zero/ or more times until--- action @end@ succeeds, and returns the list of values returned by--- @p@.  This can be used to scan comments:------ >  simpleComment   = string "<!--" *> manyTill anyChar (string "-->")------ (Note the overlapping parsers @anyChar@ and @string \"-->\"@.--- While this will work, it is not very efficient, as it will cause a--- lot of backtracking.)-manyTill :: Alternative f => f a -> f b -> f [a]-manyTill p end = scan-    where scan = (end *> pure []) <|> liftA2 (:) p scan-{-# SPECIALIZE manyTill :: Parser ByteString a -> Parser ByteString b-                        -> Parser ByteString [a] #-}---- | @manyTill' p end@ applies action @p@ /zero/ or more times until--- action @end@ succeeds, and returns the list of values returned by--- @p@.  This can be used to scan comments:------ >  simpleComment   = string "<!--" *> manyTill' anyChar (string "-->")------ (Note the overlapping parsers @anyChar@ and @string \"-->\"@.--- While this will work, it is not very efficient, as it will cause a--- lot of backtracking.)------ The value returned by @p@ is forced to WHNF.-manyTill' :: (MonadPlus m) => m a -> m b -> m [a]-manyTill' p end = scan-    where scan = (end >> return []) `mplus` liftM2' (:) p scan-{-# SPECIALIZE manyTill' :: Parser ByteString a -> Parser ByteString b-                         -> Parser ByteString [a] #-}---- | Skip zero or more instances of an action.-skipMany :: Alternative f => f a -> f ()-skipMany p = scan-    where scan = (p *> scan) <|> pure ()-{-# SPECIALIZE skipMany :: Parser ByteString a -> Parser ByteString () #-}---- | Skip one or more instances of an action.-skipMany1 :: Alternative f => f a -> f ()-skipMany1 p = p *> skipMany p-{-# SPECIALIZE skipMany1 :: Parser ByteString a -> Parser ByteString () #-}---- | Apply the given action repeatedly, returning every result.-count :: Monad m => Int -> m a -> m [a]-count n p = sequence (replicate n p)-{-# INLINE count #-}---- | Combine two alternatives.-eitherP :: (Alternative f) => f a -> f b -> f (Either a b)-eitherP a b = (Left <$> a) <|> (Right <$> b)-{-# INLINE eitherP #-}---- | If a parser has returned a 'T.Partial' result, supply it with more--- input.-feed :: Monoid i => IResult i r -> i -> IResult i r-feed f@(Fail _ _ _) _ = f-feed (Partial k) d    = k d-feed (Done t r) d     = Done (mappend t d) r-{-# INLINE feed #-}
− haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Internal.hs
@@ -1,142 +0,0 @@-{-# LANGUAGE CPP, BangPatterns, ScopedTypeVariables #-}--- |--- Module      :  Data.Attoparsec.Internal--- Copyright   :  Bryan O'Sullivan 2007-2014--- License     :  BSD3------ Maintainer  :  bos@serpentine.com--- Stability   :  experimental--- Portability :  unknown------ Simple, efficient parser combinators, loosely based on the Parsec--- library.--module Data.Attoparsec.Internal-    ( compareResults-    , prompt-    , demandInput-    , wantInput-    , endOfInput-    , atEnd-    , satisfyElem-    ) where--import Control.Applicative ((<$>))-#if __GLASGOW_HASKELL__ >= 700-import Data.ByteString (ByteString)-#endif-import Data.Attoparsec.Internal.Types-import Prelude hiding (succ)---- | Compare two 'IResult' values for equality.------ If both 'IResult's are 'Partial', the result will be 'Nothing', as--- they are incomplete and hence their equality cannot be known.--- (This is why there is no 'Eq' instance for 'IResult'.)-compareResults :: (Eq i, Eq r) => IResult i r -> IResult i r -> Maybe Bool-compareResults (Fail t0 ctxs0 msg0) (Fail t1 ctxs1 msg1) =-    Just (t0 == t1 && ctxs0 == ctxs1 && msg0 == msg1)-compareResults (Done t0 r0) (Done t1 r1) =-    Just (t0 == t1 && r0 == r1)-compareResults (Partial _) (Partial _) = Nothing-compareResults _ _ = Just False---- | Ask for input.  If we receive any, pass it to a success--- continuation, otherwise to a failure continuation.-prompt :: Chunk t-       => State t -> Pos -> More-       -> (State t -> Pos -> More -> IResult t r)-       -> (State t -> Pos -> More -> IResult t r)-       -> IResult t r-prompt t pos _more lose succ = Partial $ \s ->-  if nullChunk s-  then lose t pos Complete-  else succ (pappendChunk t s) pos Incomplete-#if __GLASGOW_HASKELL__ >= 700-{-# SPECIALIZE prompt :: State ByteString -> Pos -> More-                      -> (State ByteString -> Pos -> More-                          -> IResult ByteString r)-                      -> (State ByteString -> Pos -> More-                          -> IResult ByteString r)-                      -> IResult ByteString r #-}-#endif---- | Immediately demand more input via a 'Partial' continuation--- result.-demandInput :: Chunk t => Parser t ()-demandInput = Parser $ \t pos more lose succ ->-  case more of-    Complete -> lose t pos more [] "not enough input"-    _ -> let lose' t' pos' more' = lose t' pos' more' [] "not enough input"-             succ' t' pos' more' = succ t' pos' more' ()-         in prompt t pos more lose' succ'-#if __GLASGOW_HASKELL__ >= 700-{-# SPECIALIZE demandInput :: Parser ByteString () #-}-#endif---- | This parser always succeeds.  It returns 'True' if any input is--- available either immediately or on demand, and 'False' if the end--- of all input has been reached.-wantInput :: forall t . Chunk t => Parser t Bool-wantInput = Parser $ \t pos more _lose succ ->-  case () of-    _ | pos < atBufferEnd (undefined :: t) t -> succ t pos more True-      | more == Complete -> succ t pos more False-      | otherwise       -> let lose' t' pos' more' = succ t' pos' more' False-                               succ' t' pos' more' = succ t' pos' more' True-                           in prompt t pos more lose' succ'-{-# INLINE wantInput #-}---- | Match only if all input has been consumed.-endOfInput :: forall t . Chunk t => Parser t ()-endOfInput = Parser $ \t pos more lose succ ->-  case () of-    _| pos < atBufferEnd (undefined :: t) t -> lose t pos more [] "endOfInput"-     | more == Complete -> succ t pos more ()-     | otherwise ->-       let lose' t' pos' more' _ctx _msg = succ t' pos' more' ()-           succ' t' pos' more' _a = lose t' pos' more' [] "endOfInput"-       in  runParser demandInput t pos more lose' succ'-#if __GLASGOW_HASKELL__ >= 700-{-# SPECIALIZE endOfInput :: Parser ByteString () #-}-#endif---- | Return an indication of whether the end of input has been--- reached.-atEnd :: Chunk t => Parser t Bool-atEnd = not <$> wantInput-{-# INLINE atEnd #-}--satisfySuspended :: forall t r . Chunk t-                 => (ChunkElem t -> Bool)-                 -> State t -> Pos -> More-                 -> Failure t (State t) r-                 -> Success t (State t) (ChunkElem t) r-                 -> IResult t r-satisfySuspended p t pos more lose succ =-    runParser (demandInput >> go) t pos more lose succ-  where go = Parser $ \t' pos' more' lose' succ' ->-          case bufferElemAt (undefined :: t) pos' t' of-            Just (e, l) | p e -> succ' t' (pos' + Pos l) more' e-                        | otherwise -> lose' t' pos' more' [] "satisfyElem"-            Nothing -> runParser (demandInput >> go) t' pos' more' lose' succ'-#if __GLASGOW_HASKELL__ >= 700-{-# SPECIALIZE satisfySuspended :: (ChunkElem ByteString -> Bool)-                                -> State ByteString -> Pos -> More-                                -> Failure ByteString (State ByteString) r-                                -> Success ByteString (State ByteString)-                                           (ChunkElem ByteString) r-                                -> IResult ByteString r #-}-#endif---- | The parser @satisfyElem p@ succeeds for any chunk element for which the--- predicate @p@ returns 'True'. Returns the element that is--- actually parsed.-satisfyElem :: forall t . Chunk t-            => (ChunkElem t -> Bool) -> Parser t (ChunkElem t)-satisfyElem p = Parser $ \t pos more lose succ ->-    case bufferElemAt (undefined :: t) pos t of-      Just (e, l) | p e -> succ t (pos + Pos l) more e-                  | otherwise -> lose t pos more [] "satisfyElem"-      Nothing -> satisfySuspended p t pos more lose succ-{-# INLINE satisfyElem #-}
− haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Internal/Fhthagn.hs
@@ -1,18 +0,0 @@-{-# LANGUAGE BangPatterns, Rank2Types, OverloadedStrings,-    RecordWildCards, MagicHash, UnboxedTuples #-}--module Data.Attoparsec.Internal.Fhthagn-    (-      inlinePerformIO-    ) where--import GHC.Base (realWorld#)-import GHC.IO (IO(IO))---- | Just like unsafePerformIO, but we inline it. Big performance gains as--- it exposes lots of things to further inlining. /Very unsafe/. In--- particular, you should do no memory allocation inside an--- 'inlinePerformIO' block. On Hugs this is just @unsafePerformIO@.-inlinePerformIO :: IO a -> a-inlinePerformIO (IO m) = case m realWorld# of (# _, r #) -> r-{-# INLINE inlinePerformIO #-}
− haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Internal/Types.hs
@@ -1,230 +0,0 @@-{-# LANGUAGE BangPatterns, GeneralizedNewtypeDeriving, OverloadedStrings,-    Rank2Types, RecordWildCards, TypeFamilies #-}--- |--- Module      :  Data.Attoparsec.Internal.Types--- Copyright   :  Bryan O'Sullivan 2007-2014--- License     :  BSD3------ Maintainer  :  bos@serpentine.com--- Stability   :  experimental--- Portability :  unknown------ Simple, efficient parser combinators, loosely based on the Parsec--- library.--module Data.Attoparsec.Internal.Types-    (-      Parser(..)-    , State-    , Failure-    , Success-    , Pos(..)-    , IResult(..)-    , More(..)-    , (<>)-    , Chunk(..)-    ) where--import Control.Applicative (Alternative(..), Applicative(..), (<$>))-import Control.DeepSeq (NFData(rnf))-import Control.Monad (MonadPlus(..))-import Data.Word (Word8)-import Data.ByteString (ByteString)-import qualified Data.ByteString as BS-import Data.ByteString.Internal (w2c)-import Data.Monoid (Monoid(..))-import Prelude hiding (getChar, succ)-import qualified Data.Attoparsec.ByteString.Buffer as B--newtype Pos = Pos { fromPos :: Int }-            deriving (Eq, Ord, Show, Num)---- | The result of a parse.  This is parameterised over the type @i@--- of string that was processed.------ This type is an instance of 'Functor', where 'fmap' transforms the--- value in a 'Done' result.-data IResult i r =-    Fail i [String] String-    -- ^ The parse failed.  The @i@ parameter is the input that had-    -- not yet been consumed when the failure occurred.  The-    -- @[@'String'@]@ is a list of contexts in which the error-    -- occurred.  The 'String' is the message describing the error, if-    -- any.-  | Partial (i -> IResult i r)-    -- ^ Supply this continuation with more input so that the parser-    -- can resume.  To indicate that no more input is available, pass-    -- an empty string to the continuation.-    ---    -- __Note__: if you get a 'Partial' result, do not call its-    -- continuation more than once.-  | Done i r-    -- ^ The parse succeeded.  The @i@ parameter is the input that had-    -- not yet been consumed (if any) when the parse succeeded.--instance (Show i, Show r) => Show (IResult i r) where-    show (Fail t stk msg) =-      unwords [ "Fail", show t, show stk, show msg]-    show (Partial _)          = "Partial _"-    show (Done t r)       = unwords ["Done", show t, show r]--instance (NFData i, NFData r) => NFData (IResult i r) where-    rnf (Fail t stk msg) = rnf t `seq` rnf stk `seq` rnf msg-    rnf (Partial _)  = ()-    rnf (Done t r)   = rnf t `seq` rnf r-    {-# INLINE rnf #-}--instance Functor (IResult i) where-    fmap _ (Fail t stk msg) = Fail t stk msg-    fmap f (Partial k)      = Partial (fmap f . k)-    fmap f (Done t r)   = Done t (f r)---- | The core parser type.  This is parameterised over the types @i@--- of string being processed and @t@ of internal state representation.------ This type is an instance of the following classes:------ * 'Monad', where 'fail' throws an exception (i.e. fails) with an---   error message.------ * 'Functor' and 'Applicative', which follow the usual definitions.------ * 'MonadPlus', where 'mzero' fails (with no error message) and---   'mplus' executes the right-hand parser if the left-hand one---   fails.  When the parser on the right executes, the input is reset---   to the same state as the parser on the left started with. (In---   other words, attoparsec is a backtracking parser that supports---   arbitrary lookahead.)------ * 'Alternative', which follows 'MonadPlus'.-newtype Parser i a = Parser {-      runParser :: forall r.-                   State i -> Pos -> More-                -> Failure i (State i)   r-                -> Success i (State i) a r-                -> IResult i r-    }--type family State i-type instance State ByteString = B.Buffer--type Failure i t   r = t -> Pos -> More -> [String] -> String-                       -> IResult i r-type Success i t a r = t -> Pos -> More -> a -> IResult i r---- | Have we read all available input?-data More = Complete | Incomplete-            deriving (Eq, Show)--instance Monoid More where-    mappend c@Complete _ = c-    mappend _ m          = m-    mempty               = Incomplete--instance Monad (Parser i) where-    fail err = Parser $ \t pos more lose _succ -> lose t pos more [] msg-      where msg = "Failed reading: " ++ err-    {-# INLINE fail #-}--    return = pure-    {-# INLINE return #-}--    m >>= k = Parser $ \t !pos more lose succ ->-        let succ' t' !pos' more' a = runParser (k a) t' pos' more' lose succ-        in runParser m t pos more lose succ'-    {-# INLINE (>>=) #-}--plus :: Parser i a -> Parser i a -> Parser i a-plus f g = Parser $ \t pos more lose succ ->-  let lose' t' _pos' more' _ctx _msg = runParser g t' pos more' lose succ-  in runParser f t pos more lose' succ--instance MonadPlus (Parser i) where-    mzero = fail "mzero"-    {-# INLINE mzero #-}-    mplus = plus--instance Functor (Parser i) where-    fmap f p = Parser $ \t pos more lose succ ->-      let succ' t' pos' more' a = succ t' pos' more' (f a)-      in runParser p t pos more lose succ'-    {-# INLINE fmap #-}--apP :: Parser i (a -> b) -> Parser i a -> Parser i b-apP d e = do-  b <- d-  a <- e-  return (b a)-{-# INLINE apP #-}--instance Applicative (Parser i) where-    pure v = Parser $ \t pos more _lose succ -> succ t pos more v-    {-# INLINE pure #-}-    (<*>)  = apP-    {-# INLINE (<*>) #-}--    -- These definitions are equal to the defaults, but this-    -- way the optimizer doesn't have to work so hard to figure-    -- that out.-    m *> k = m >>= \_ -> k-    {-# INLINE (*>) #-}-    x <* y = x >>= \a -> y >> return a-    {-# INLINE (<*) #-}--instance Monoid (Parser i a) where-    mempty  = fail "mempty"-    {-# INLINE mempty #-}-    mappend = plus-    {-# INLINE mappend #-}--instance Alternative (Parser i) where-    empty = fail "empty"-    {-# INLINE empty #-}--    (<|>) = plus-    {-# INLINE (<|>) #-}--    many v = many_v-        where many_v = some_v <|> pure []-              some_v = (:) <$> v <*> many_v-    {-# INLINE many #-}--    some v = some_v-      where-        many_v = some_v <|> pure []-        some_v = (:) <$> v <*> many_v-    {-# INLINE some #-}--(<>) :: (Monoid m) => m -> m -> m-(<>) = mappend-{-# INLINE (<>) #-}---- | A common interface for input chunks.-class Monoid c => Chunk c where-  type ChunkElem c-  -- | Test if the chunk is empty.-  nullChunk :: c -> Bool-  -- | Append chunk to a buffer.-  pappendChunk :: State c -> c -> State c-  -- | Position at the end of a buffer. The first argument is ignored.-  atBufferEnd :: c -> State c -> Pos-  -- | Return the buffer element at the given position along with its length.-  bufferElemAt :: c -> Pos -> State c -> Maybe (ChunkElem c, Int)-  -- | Map an element to the corresponding character.-  --   The first argument is ignored.-  chunkElemToChar :: c -> ChunkElem c -> Char--instance Chunk ByteString where-  type ChunkElem ByteString = Word8-  nullChunk = BS.null-  {-# INLINE nullChunk #-}-  pappendChunk = B.pappend-  {-# INLINE pappendChunk #-}-  atBufferEnd _ = Pos . B.length-  {-# INLINE atBufferEnd #-}-  bufferElemAt _ (Pos i) buf-    | i < B.length buf = Just (B.unsafeIndex buf i, 1)-    | otherwise = Nothing-  {-# INLINE bufferElemAt #-}-  chunkElemToChar _ = w2c-  {-# INLINE chunkElemToChar #-}
− haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Number.hs
@@ -1,137 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}--- |--- Module      :  Data.Attoparsec.Number--- Copyright   :  Bryan O'Sullivan 2007-2014--- License     :  BSD3------ Maintainer  :  bos@serpentine.com--- Stability   :  experimental--- Portability :  unknown------ This module is deprecated, and both the module and 'Number' type--- will be removed in the next major release.  Use the--- <http://hackage.haskell.org/package/scientific scientific> package--- and the 'Data.Scientific.Scientific' type instead.------ A simple number type, useful for parsing both exact and inexact--- quantities without losing much precision.-module Data.Attoparsec.Number-    {-# DEPRECATED "This module will be removed in the next major release." #-}-    (-      Number(..)-    ) where--import Control.DeepSeq (NFData(rnf))-import Data.Data (Data)-import Data.Function (on)-import Data.Typeable (Typeable)---- | A numeric type that can represent integers accurately, and--- floating point numbers to the precision of a 'Double'.------ /Note/: this type is deprecated, and will be removed in the next--- major release.  Use the 'Data.Scientific.Scientific' type instead.-data Number = I !Integer-            | D {-# UNPACK #-} !Double-              deriving (Typeable, Data)-{-# DEPRECATED Number "Use Scientific instead." #-}--instance Show Number where-    show (I a) = show a-    show (D a) = show a--instance NFData Number where-    rnf (I _) = ()-    rnf (D _) = ()-    {-# INLINE rnf #-}--binop :: (Integer -> Integer -> a) -> (Double -> Double -> a)-      -> Number -> Number -> a-binop _ d (D a) (D b) = d a b-binop i _ (I a) (I b) = i a b-binop _ d (D a) (I b) = d a (fromIntegral b)-binop _ d (I a) (D b) = d (fromIntegral a) b-{-# INLINE binop #-}--instance Eq Number where-    (==) = binop (==) (==)-    {-# INLINE (==) #-}--    (/=) = binop (/=) (/=)-    {-# INLINE (/=) #-}--instance Ord Number where-    (<) = binop (<) (<)-    {-# INLINE (<) #-}--    (<=) = binop (<=) (<=)-    {-# INLINE (<=) #-}--    (>) = binop (>) (>)-    {-# INLINE (>) #-}--    (>=) = binop (>=) (>=)-    {-# INLINE (>=) #-}--    compare = binop compare compare-    {-# INLINE compare #-}--instance Num Number where-    (+) = binop (((I$!).) . (+)) (((D$!).) . (+))-    {-# INLINE (+) #-}--    (-) = binop (((I$!).) . (-)) (((D$!).) . (-))-    {-# INLINE (-) #-}--    (*) = binop (((I$!).) . (*)) (((D$!).) . (*))-    {-# INLINE (*) #-}--    abs (I a) = I $! abs a-    abs (D a) = D $! abs a-    {-# INLINE abs #-}--    negate (I a) = I $! negate a-    negate (D a) = D $! negate a-    {-# INLINE negate #-}--    signum (I a) = I $! signum a-    signum (D a) = D $! signum a-    {-# INLINE signum #-}--    fromInteger = (I$!) . fromInteger-    {-# INLINE fromInteger #-}--instance Real Number where-    toRational (I a) = fromIntegral a-    toRational (D a) = toRational a-    {-# INLINE toRational #-}--instance Fractional Number where-    fromRational = (D$!) . fromRational-    {-# INLINE fromRational #-}--    (/) = binop (((D$!).) . (/) `on` fromIntegral)-                (((D$!).) . (/))-    {-# INLINE (/) #-}--    recip (I a) = D $! recip (fromIntegral a)-    recip (D a) = D $! recip a-    {-# INLINE recip #-}--instance RealFrac Number where-    properFraction (I a) = (fromIntegral a,0)-    properFraction (D a) = case properFraction a of-                             (i,d) -> (i,D d)-    {-# INLINE properFraction #-}-    truncate (I a) = fromIntegral a-    truncate (D a) = truncate a-    {-# INLINE truncate #-}-    round (I a) = fromIntegral a-    round (D a) = round a-    {-# INLINE round #-}-    ceiling (I a) = fromIntegral a-    ceiling (D a) = ceiling a-    {-# INLINE ceiling #-}-    floor (I a) = fromIntegral a-    floor (D a) = floor a-    {-# INLINE floor #-}
+ haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec.hs view
@@ -0,0 +1,23 @@+-- |+-- Module      :  Data.Attoparsec+-- Copyright   :  Bryan O'Sullivan 2007-2015+-- License     :  BSD3+--+-- Maintainer  :  bos@serpentine.com+-- Stability   :  experimental+-- Portability :  unknown+--+-- Simple, efficient combinator parsing for+-- 'Data.ByteString.ByteString' strings, loosely based on the Parsec+-- library.+--+-- This module is deprecated. Use "Data.Attoparsec.ByteString"+-- instead.++module Data.Attoparsec+    {-# DEPRECATED "This module will be removed in the next major release." #-}+    (+      module Data.Attoparsec.ByteString+    ) where++import Data.Attoparsec.ByteString
+ haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString.hs view
@@ -0,0 +1,230 @@+{-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif+-- |+-- Module      :  Data.Attoparsec.ByteString+-- Copyright   :  Bryan O'Sullivan 2007-2015+-- License     :  BSD3+--+-- Maintainer  :  bos@serpentine.com+-- Stability   :  experimental+-- Portability :  unknown+--+-- Simple, efficient combinator parsing for 'B.ByteString' strings,+-- loosely based on the Parsec library.++module Data.Attoparsec.ByteString+    (+    -- * Differences from Parsec+    -- $parsec++    -- * Incremental input+    -- $incremental++    -- * Performance considerations+    -- $performance++    -- * Parser types+      I.Parser+    , Result+    , T.IResult(..)+    , I.compareResults++    -- * Running parsers+    , parse+    , feed+    , I.parseOnly+    , parseWith+    , parseTest++    -- ** Result conversion+    , maybeResult+    , eitherResult++    -- * Parsing individual bytes+    , I.word8+    , I.anyWord8+    , I.notWord8+    , I.satisfy+    , I.satisfyWith+    , I.skip++    -- ** Lookahead+    , I.peekWord8+    , I.peekWord8'++    -- ** Byte classes+    , I.inClass+    , I.notInClass++    -- * Efficient string handling+    , I.string+    , I.skipWhile+    , I.take+    , I.scan+    , I.runScanner+    , I.takeWhile+    , I.takeWhile1+    , I.takeTill++    -- ** Consume all remaining input+    , I.takeByteString+    , I.takeLazyByteString++    -- * Combinators+    , try+    , (<?>)+    , choice+    , count+    , option+    , many'+    , many1+    , many1'+    , manyTill+    , manyTill'+    , sepBy+    , sepBy'+    , sepBy1+    , sepBy1'+    , skipMany+    , skipMany1+    , eitherP+    , I.match+    -- * State observation and manipulation functions+    , I.endOfInput+    , I.atEnd+    ) where++import Data.Attoparsec.Combinator+import Data.List (intercalate)+import qualified Data.Attoparsec.ByteString.Internal as I+import qualified Data.Attoparsec.Internal as I+import qualified Data.ByteString as B+import Data.Attoparsec.ByteString.Internal (Result, parse)+import qualified Data.Attoparsec.Internal.Types as T++-- $parsec+--+-- Compared to Parsec 3, attoparsec makes several tradeoffs.  It is+-- not intended for, or ideal for, all possible uses.+--+-- * While attoparsec can consume input incrementally, Parsec cannot.+--   Incremental input is a huge deal for efficient and secure network+--   and system programming, since it gives much more control to users+--   of the library over matters such as resource usage and the I/O+--   model to use.+--+-- * Much of the performance advantage of attoparsec is gained via+--   high-performance parsers such as 'I.takeWhile' and 'I.string'.+--   If you use complicated combinators that return lists of bytes or+--   characters, there is less performance difference between the two+--   libraries.+--+-- * Unlike Parsec 3, attoparsec does not support being used as a+--   monad transformer.+--+-- * attoparsec is specialised to deal only with strict 'B.ByteString'+--   input.  Efficiency concerns rule out both lists and lazy+--   bytestrings.  The usual use for lazy bytestrings would be to+--   allow consumption of very large input without a large footprint.+--   For this need, attoparsec's incremental input provides an+--   excellent substitute, with much more control over when input+--   takes place.  If you must use lazy bytestrings, see the+--   "Data.Attoparsec.ByteString.Lazy" module, which feeds lazy chunks+--   to a regular parser.+--+-- * Parsec parsers can produce more helpful error messages than+--   attoparsec parsers.  This is a matter of focus: attoparsec avoids+--   the extra book-keeping in favour of higher performance.++-- $incremental+--+-- attoparsec supports incremental input, meaning that you can feed it+-- a bytestring that represents only part of the expected total amount+-- of data to parse. If your parser reaches the end of a fragment of+-- input and could consume more input, it will suspend parsing and+-- return a 'T.Partial' continuation.+--+-- Supplying the 'T.Partial' continuation with a bytestring will+-- resume parsing at the point where it was suspended, with the+-- bytestring you supplied used as new input at the end of the+-- existing input. You must be prepared for the result of the resumed+-- parse to be another 'T.Partial' continuation.+--+-- To indicate that you have no more input, supply the 'T.Partial'+-- continuation with an empty bytestring.+--+-- Remember that some parsing combinators will not return a result+-- until they reach the end of input.  They may thus cause 'T.Partial'+-- results to be returned.+--+-- If you do not need support for incremental input, consider using+-- the 'I.parseOnly' function to run your parser.  It will never+-- prompt for more input.+--+-- /Note/: incremental input does /not/ imply that attoparsec will+-- release portions of its internal state for garbage collection as it+-- proceeds.  Its internal representation is equivalent to a single+-- 'ByteString': if you feed incremental input to a parser, it will+-- require memory proportional to the amount of input you supply.+-- (This is necessary to support arbitrary backtracking.)++-- $performance+--+-- If you write an attoparsec-based parser carefully, it can be+-- realistic to expect it to perform similarly to a hand-rolled C+-- parser (measuring megabytes parsed per second).+--+-- To actually achieve high performance, there are a few guidelines+-- that it is useful to follow.+--+-- Use the 'B.ByteString'-oriented parsers whenever possible,+-- e.g. 'I.takeWhile1' instead of 'many1' 'I.anyWord8'.  There is+-- about a factor of 100 difference in performance between the two+-- kinds of parser.+--+-- For very simple byte-testing predicates, write them by hand instead+-- of using 'I.inClass' or 'I.notInClass'.  For instance, both of+-- these predicates test for an end-of-line byte, but the first is+-- much faster than the second:+--+-- >endOfLine_fast w = w == 13 || w == 10+-- >endOfLine_slow   = inClass "\r\n"+--+-- Make active use of benchmarking and profiling tools to measure,+-- find the problems with, and improve the performance of your parser.++-- | Run a parser and print its result to standard output.+parseTest :: (Show a) => I.Parser a -> B.ByteString -> IO ()+parseTest p s = print (parse p s)++-- | Run a parser with an initial input string, and a monadic action+-- that can supply more input if needed.+parseWith :: Monad m =>+             (m B.ByteString)+          -- ^ An action that will be executed to provide the parser+          -- with more input, if necessary.  The action must return an+          -- 'B.empty' string when there is no more input available.+          -> I.Parser a+          -> B.ByteString+          -- ^ Initial input for the parser.+          -> m (Result a)+parseWith refill p s = step $ parse p s+  where step (T.Partial k) = (step . k) =<< refill+        step r             = return r+{-# INLINE parseWith #-}++-- | Convert a 'Result' value to a 'Maybe' value. A 'T.Partial' result+-- is treated as failure.+maybeResult :: Result r -> Maybe r+maybeResult (T.Done _ r) = Just r+maybeResult _            = Nothing++-- | Convert a 'Result' value to an 'Either' value. A 'T.Partial'+-- result is treated as failure.+eitherResult :: Result r -> Either String r+eitherResult (T.Done _ r)        = Right r+eitherResult (T.Fail _ [] msg)   = Left msg+eitherResult (T.Fail _ ctxs msg) = Left (intercalate " > " ctxs ++ ": " ++ msg)+eitherResult _                   = Left "Result: incomplete input"
+ haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString/Buffer.hs view
@@ -0,0 +1,156 @@+{-# LANGUAGE BangPatterns #-}+-- |+-- Module      :  Data.Attoparsec.ByteString.Buffer+-- Copyright   :  Bryan O'Sullivan 2007-2015+-- License     :  BSD3+--+-- Maintainer  :  bos@serpentine.com+-- Stability   :  experimental+-- Portability :  GHC+--+-- An "immutable" buffer that supports cheap appends.+--+-- A Buffer is divided into an immutable read-only zone, followed by a+-- mutable area that we've preallocated, but not yet written to.+--+-- We overallocate at the end of a Buffer so that we can cheaply+-- append.  Since a user of an existing Buffer cannot see past the end+-- of its immutable zone into the data that will change during an+-- append, this is safe.+--+-- Once we run out of space at the end of a Buffer, we do the usual+-- doubling of the buffer size.+--+-- The fact of having a mutable buffer really helps with performance,+-- but it does have a consequence: if someone misuses the Partial API+-- that attoparsec uses by calling the same continuation repeatedly+-- (which never makes sense in practice), they could overwrite data.+--+-- Since the API *looks* pure, it should *act* pure, too, so we use+-- two generation counters (one mutable, one immutable) to track the+-- number of appends to a mutable buffer. If the counters ever get out+-- of sync, someone is appending twice to a mutable buffer, so we+-- duplicate the entire buffer in order to preserve the immutability+-- of its older self.+--+-- While we could go a step further and gain protection against API+-- abuse on a multicore system, by use of an atomic increment+-- instruction to bump the mutable generation counter, that would be+-- very expensive, and feels like it would also be in the realm of the+-- ridiculous.  Clients should never call a continuation more than+-- once; we lack a linear type system that could enforce this; and+-- there's only so far we should go to accommodate broken uses.++module Data.Attoparsec.ByteString.Buffer+    (+      Buffer+    , buffer+    , unbuffer+    , pappend+    , length+    , unsafeIndex+    , substring+    , unsafeDrop+    ) where++import Control.Exception (assert)+import Data.ByteString.Internal (ByteString(..), memcpy, nullForeignPtr)+import Data.Attoparsec.Internal.Fhthagn (inlinePerformIO)+import Data.List (foldl1')+import Data.Monoid as Mon (Monoid(..))+import Data.Semigroup (Semigroup(..))+import Data.Word (Word8)+import Foreign.ForeignPtr (ForeignPtr, withForeignPtr)+import Foreign.Ptr (castPtr, plusPtr)+import Foreign.Storable (peek, peekByteOff, poke, sizeOf)+import GHC.ForeignPtr (mallocPlainForeignPtrBytes)+import Prelude hiding (length)++-- If _cap is zero, this buffer is empty.+data Buffer = Buf {+      _fp  :: {-# UNPACK #-} !(ForeignPtr Word8)+    , _off :: {-# UNPACK #-} !Int+    , _len :: {-# UNPACK #-} !Int+    , _cap :: {-# UNPACK #-} !Int+    , _gen :: {-# UNPACK #-} !Int+    }++instance Show Buffer where+    showsPrec p = showsPrec p . unbuffer++-- | The initial 'Buffer' has no mutable zone, so we can avoid all+-- copies in the (hopefully) common case of no further input being fed+-- to us.+buffer :: ByteString -> Buffer+buffer (PS fp off len) = Buf fp off len len 0++unbuffer :: Buffer -> ByteString+unbuffer (Buf fp off len _ _) = PS fp off len++instance Semigroup Buffer where+    (Buf _ _ _ 0 _) <> b                    = b+    a               <> (Buf _ _ _ 0 _)      = a+    buf             <> (Buf fp off len _ _) = append buf fp off len++instance Monoid Buffer where+    mempty = Buf nullForeignPtr 0 0 0 0++    mappend = (<>)++    mconcat [] = Mon.mempty+    mconcat xs = foldl1' mappend xs++pappend :: Buffer -> ByteString -> Buffer+pappend (Buf _ _ _ 0 _) bs  = buffer bs+pappend buf (PS fp off len) = append buf fp off len++append :: Buffer -> ForeignPtr a -> Int -> Int -> Buffer+append (Buf fp0 off0 len0 cap0 gen0) !fp1 !off1 !len1 =+  inlinePerformIO . withForeignPtr fp0 $ \ptr0 ->+    withForeignPtr fp1 $ \ptr1 -> do+      let genSize = sizeOf (0::Int)+          newlen  = len0 + len1+      gen <- if gen0 == 0+             then return 0+             else peek (castPtr ptr0)+      if gen == gen0 && newlen <= cap0+        then do+          let newgen = gen + 1+          poke (castPtr ptr0) newgen+          memcpy (ptr0 `plusPtr` (off0+len0))+                 (ptr1 `plusPtr` off1)+                 (fromIntegral len1)+          return (Buf fp0 off0 newlen cap0 newgen)+        else do+          let newcap = newlen * 2+          fp <- mallocPlainForeignPtrBytes (newcap + genSize)+          withForeignPtr fp $ \ptr_ -> do+            let ptr    = ptr_ `plusPtr` genSize+                newgen = 1+            poke (castPtr ptr_) newgen+            memcpy ptr (ptr0 `plusPtr` off0) (fromIntegral len0)+            memcpy (ptr `plusPtr` len0) (ptr1 `plusPtr` off1)+                   (fromIntegral len1)+            return (Buf fp genSize newlen newcap newgen)++length :: Buffer -> Int+length (Buf _ _ len _ _) = len+{-# INLINE length #-}++unsafeIndex :: Buffer -> Int -> Word8+unsafeIndex (Buf fp off len _ _) i = assert (i >= 0 && i < len) .+    inlinePerformIO . withForeignPtr fp $ flip peekByteOff (off+i)+{-# INLINE unsafeIndex #-}++substring :: Int -> Int -> Buffer -> ByteString+substring s l (Buf fp off len _ _) =+  assert (s >= 0 && s <= len) .+  assert (l >= 0 && l <= len-s) $+  PS fp (off+s) l+{-# INLINE substring #-}++unsafeDrop :: Int -> Buffer -> ByteString+unsafeDrop s (Buf fp off len _ _) =+  assert (s >= 0 && s <= len) $+  PS fp (off+s) (len-s)+{-# INLINE unsafeDrop #-}
+ haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString/Char8.hs view
@@ -0,0 +1,464 @@+{-# LANGUAGE BangPatterns, CPP, FlexibleInstances, TypeFamilies,+    TypeSynonymInstances, GADTs #-}+#if __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-} -- Imports internal modules+#endif+{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-warnings-deprecations #-}++-- |+-- Module      :  Data.Attoparsec.ByteString.Char8+-- Copyright   :  Bryan O'Sullivan 2007-2015+-- License     :  BSD3+--+-- Maintainer  :  bos@serpentine.com+-- Stability   :  experimental+-- Portability :  unknown+--+-- Simple, efficient, character-oriented combinator parsing for+-- 'B.ByteString' strings, loosely based on the Parsec library.++module Data.Attoparsec.ByteString.Char8+    (+    -- * Character encodings+    -- $encodings++    -- * Parser types+      Parser+    , A.Result+    , A.IResult(..)+    , I.compareResults++    -- * Running parsers+    , A.parse+    , A.feed+    , A.parseOnly+    , A.parseWith+    , A.parseTest++    -- ** Result conversion+    , A.maybeResult+    , A.eitherResult++    -- * Parsing individual characters+    , char+    , char8+    , anyChar+    , notChar+    , satisfy++    -- ** Lookahead+    , peekChar+    , peekChar'++    -- ** Special character parsers+    , digit+    , letter_iso8859_15+    , letter_ascii+    , space++    -- ** Fast predicates+    , isDigit+    , isDigit_w8+    , isAlpha_iso8859_15+    , isAlpha_ascii+    , isSpace+    , isSpace_w8++    -- *** Character classes+    , inClass+    , notInClass++    -- * Efficient string handling+    , I.string+    , I.stringCI+    , skipSpace+    , skipWhile+    , I.take+    , scan+    , takeWhile+    , takeWhile1+    , takeTill++    -- ** String combinators+    -- $specalt+    , (.*>)+    , (<*.)++    -- ** Consume all remaining input+    , I.takeByteString+    , I.takeLazyByteString++    -- * Text parsing+    , I.endOfLine+    , isEndOfLine+    , isHorizontalSpace++    -- * Numeric parsers+    , decimal+    , hexadecimal+    , signed++    -- * Combinators+    , try+    , (<?>)+    , choice+    , count+    , option+    , many'+    , many1+    , many1'+    , manyTill+    , manyTill'+    , sepBy+    , sepBy'+    , sepBy1+    , sepBy1'+    , skipMany+    , skipMany1+    , eitherP+    , I.match+    -- * State observation and manipulation functions+    , I.endOfInput+    , I.atEnd+    ) where++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative (pure, (*>), (<*), (<$>))+import Data.Word (Word)+#endif+import Control.Applicative ((<|>))+import Data.Attoparsec.ByteString.FastSet (charClass, memberChar)+import Data.Attoparsec.ByteString.Internal (Parser)+import Data.Attoparsec.Combinator+import Data.Bits (Bits, (.|.), shiftL)+import Data.ByteString.Internal (c2w, w2c)+import Data.Int (Int8, Int16, Int32, Int64)+import Data.String (IsString(..))+import Data.Word (Word8, Word16, Word32, Word64)+import Prelude hiding (takeWhile)+import qualified Data.Attoparsec.ByteString as A+import qualified Data.Attoparsec.ByteString.Internal as I+import qualified Data.Attoparsec.Internal as I+import qualified Data.ByteString as B8+import qualified Data.ByteString.Char8 as B++instance (a ~ B.ByteString) => IsString (Parser a) where+    fromString = I.string . B.pack++-- $encodings+--+-- This module is intended for parsing text that is+-- represented using an 8-bit character set, e.g. ASCII or+-- ISO-8859-15.  It /does not/ make any attempt to deal with character+-- encodings, multibyte characters, or wide characters.  In+-- particular, all attempts to use characters above code point U+00FF+-- will give wrong answers.+--+-- Code points below U+0100 are simply translated to and from their+-- numeric values, so e.g. the code point U+00A4 becomes the byte+-- @0xA4@ (which is the Euro symbol in ISO-8859-15, but the generic+-- currency sign in ISO-8859-1).  Haskell 'Char' values above U+00FF+-- are truncated, so e.g. U+1D6B7 is truncated to the byte @0xB7@.++-- | Consume input as long as the predicate returns 'True', and return+-- the consumed input.+--+-- This parser requires the predicate to succeed on at least one byte+-- of input: it will fail if the predicate never returns 'True' or if+-- there is no input left.+takeWhile1 :: (Char -> Bool) -> Parser B.ByteString+takeWhile1 p = I.takeWhile1 (p . w2c)+{-# INLINE takeWhile1 #-}++-- | The parser @satisfy p@ succeeds for any byte for which the+-- predicate @p@ returns 'True'. Returns the byte that is actually+-- parsed.+--+-- >digit = satisfy isDigit+-- >    where isDigit c = c >= '0' && c <= '9'+satisfy :: (Char -> Bool) -> Parser Char+satisfy = I.satisfyWith w2c+{-# INLINE satisfy #-}++-- | Match a letter, in the ISO-8859-15 encoding.+letter_iso8859_15 :: Parser Char+letter_iso8859_15 = satisfy isAlpha_iso8859_15 <?> "letter_iso8859_15"+{-# INLINE letter_iso8859_15 #-}++-- | Match a letter, in the ASCII encoding.+letter_ascii :: Parser Char+letter_ascii = satisfy isAlpha_ascii <?> "letter_ascii"+{-# INLINE letter_ascii #-}++-- | A fast alphabetic predicate for the ISO-8859-15 encoding+--+-- /Note/: For all character encodings other than ISO-8859-15, and+-- almost all Unicode code points above U+00A3, this predicate gives+-- /wrong answers/.+isAlpha_iso8859_15 :: Char -> Bool+isAlpha_iso8859_15 c = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||+                       (c >= '\166' && moby c)+  where moby = notInClass "\167\169\171-\179\182\183\185\187\191\215\247"+        {-# NOINLINE moby #-}+{-# INLINE isAlpha_iso8859_15 #-}++-- | A fast alphabetic predicate for the ASCII encoding+--+-- /Note/: For all character encodings other than ASCII, and+-- almost all Unicode code points above U+007F, this predicate gives+-- /wrong answers/.+isAlpha_ascii :: Char -> Bool+isAlpha_ascii c = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')+{-# INLINE isAlpha_ascii #-}++-- | Parse a single digit.+digit :: Parser Char+digit = satisfy isDigit <?> "digit"+{-# INLINE digit #-}++-- | A fast digit predicate.+isDigit :: Char -> Bool+isDigit c = c >= '0' && c <= '9'+{-# INLINE isDigit #-}++-- | A fast digit predicate.+isDigit_w8 :: Word8 -> Bool+isDigit_w8 w = w - 48 <= 9+{-# INLINE isDigit_w8 #-}++-- | Match any character.+anyChar :: Parser Char+anyChar = satisfy $ const True+{-# INLINE anyChar #-}++-- | Match any character, to perform lookahead. Returns 'Nothing' if+-- end of input has been reached. Does not consume any input.+--+-- /Note/: Because this parser does not fail, do not use it with+-- combinators such as 'many', because such parsers loop until a+-- failure occurs.  Careless use will thus result in an infinite loop.+peekChar :: Parser (Maybe Char)+peekChar = (fmap w2c) `fmap` I.peekWord8+{-# INLINE peekChar #-}++-- | Match any character, to perform lookahead.  Does not consume any+-- input, but will fail if end of input has been reached.+peekChar' :: Parser Char+peekChar' = w2c `fmap` I.peekWord8'+{-# INLINE peekChar' #-}++-- | Fast predicate for matching ASCII space characters.+--+-- /Note/: This predicate only gives correct answers for the ASCII+-- encoding.  For instance, it does not recognise U+00A0 (non-breaking+-- space) as a space character, even though it is a valid ISO-8859-15+-- byte. For a Unicode-aware and only slightly slower predicate,+-- use 'Data.Char.isSpace'+isSpace :: Char -> Bool+isSpace c = (c == ' ') || ('\t' <= c && c <= '\r')+{-# INLINE isSpace #-}++-- | Fast 'Word8' predicate for matching ASCII space characters.+isSpace_w8 :: Word8 -> Bool+isSpace_w8 w = w == 32 || w - 9 <= 4+{-# INLINE isSpace_w8 #-}+++-- | Parse a space character.+--+-- /Note/: This parser only gives correct answers for the ASCII+-- encoding.  For instance, it does not recognise U+00A0 (non-breaking+-- space) as a space character, even though it is a valid ISO-8859-15+-- byte.+space :: Parser Char+space = satisfy isSpace <?> "space"+{-# INLINE space #-}++-- | Match a specific character.+char :: Char -> Parser Char+char c = satisfy (== c) <?> [c]+{-# INLINE char #-}++-- | Match a specific character, but return its 'Word8' value.+char8 :: Char -> Parser Word8+char8 c = I.satisfy (== c2w c) <?> [c]+{-# INLINE char8 #-}++-- | Match any character except the given one.+notChar :: Char -> Parser Char+notChar c = satisfy (/= c) <?> "not " ++ [c]+{-# INLINE notChar #-}++-- | Match any character in a set.+--+-- >vowel = inClass "aeiou"+--+-- Range notation is supported.+--+-- >halfAlphabet = inClass "a-nA-N"+--+-- To add a literal \'-\' to a set, place it at the beginning or end+-- of the string.+inClass :: String -> Char -> Bool+inClass s = (`memberChar` mySet)+    where mySet = charClass s+{-# INLINE inClass #-}++-- | Match any character not in a set.+notInClass :: String -> Char -> Bool+notInClass s = not . inClass s+{-# INLINE notInClass #-}++-- | Consume input as long as the predicate returns 'True', and return+-- the consumed input.+--+-- This parser does not fail.  It will return an empty string if the+-- predicate returns 'False' on the first byte of input.+--+-- /Note/: Because this parser does not fail, do not use it with+-- combinators such as 'many', because such parsers loop until a+-- failure occurs.  Careless use will thus result in an infinite loop.+takeWhile :: (Char -> Bool) -> Parser B.ByteString+takeWhile p = I.takeWhile (p . w2c)+{-# INLINE takeWhile #-}++-- | A stateful scanner.  The predicate consumes and transforms a+-- state argument, and each transformed state is passed to successive+-- invocations of the predicate on each byte of the input until one+-- returns 'Nothing' or the input ends.+--+-- This parser does not fail.  It will return an empty string if the+-- predicate returns 'Nothing' on the first byte of input.+--+-- /Note/: Because this parser does not fail, do not use it with+-- combinators such as 'many', because such parsers loop until a+-- failure occurs.  Careless use will thus result in an infinite loop.+scan :: s -> (s -> Char -> Maybe s) -> Parser B.ByteString+scan s0 p = I.scan s0 (\s -> p s . w2c)+{-# INLINE scan #-}++-- | Consume input as long as the predicate returns 'False'+-- (i.e. until it returns 'True'), and return the consumed input.+--+-- This parser does not fail.  It will return an empty string if the+-- predicate returns 'True' on the first byte of input.+--+-- /Note/: Because this parser does not fail, do not use it with+-- combinators such as 'many', because such parsers loop until a+-- failure occurs.  Careless use will thus result in an infinite loop.+takeTill :: (Char -> Bool) -> Parser B.ByteString+takeTill p = I.takeTill (p . w2c)+{-# INLINE takeTill #-}++-- | Skip past input for as long as the predicate returns 'True'.+skipWhile :: (Char -> Bool) -> Parser ()+skipWhile p = I.skipWhile (p . w2c)+{-# INLINE skipWhile #-}++-- | Skip over white space.+skipSpace :: Parser ()+skipSpace = I.skipWhile isSpace_w8+{-# INLINE skipSpace #-}++-- $specalt+--+-- If you enable the @OverloadedStrings@ language extension, you can+-- use the '*>' and '<*' combinators to simplify the common task of+-- matching a statically known string, then immediately parsing+-- something else.+--+-- Instead of writing something like this:+--+-- @+--'I.string' \"foo\" '*>' wibble+-- @+--+-- Using @OverloadedStrings@, you can omit the explicit use of+-- 'I.string', and write a more compact version:+--+-- @+-- \"foo\" '*>' wibble+-- @+--+-- (Note: the '.*>' and '<*.' combinators that were originally+-- provided for this purpose are obsolete and unnecessary, and will be+-- removed in the next major version.)++-- | /Obsolete/. A type-specialized version of '*>' for+-- 'B.ByteString'. Use '*>' instead.+(.*>) :: B.ByteString -> Parser a -> Parser a+s .*> f = I.string s *> f+{-# DEPRECATED (.*>) "This is no longer necessary, and will be removed. Use '*>' instead." #-}++-- | /Obsolete/. A type-specialized version of '<*' for+-- 'B.ByteString'. Use '<*' instead.+(<*.) :: Parser a -> B.ByteString -> Parser a+f <*. s = f <* I.string s+{-# DEPRECATED (<*.) "This is no longer necessary, and will be removed. Use '<*' instead." #-}++-- | A predicate that matches either a carriage return @\'\\r\'@ or+-- newline @\'\\n\'@ character.+isEndOfLine :: Word8 -> Bool+isEndOfLine w = w == 13 || w == 10+{-# INLINE isEndOfLine #-}++-- | A predicate that matches either a space @\' \'@ or horizontal tab+-- @\'\\t\'@ character.+isHorizontalSpace :: Word8 -> Bool+isHorizontalSpace w = w == 32 || w == 9+{-# INLINE isHorizontalSpace #-}++-- | Parse and decode an unsigned hexadecimal number.  The hex digits+-- @\'a\'@ through @\'f\'@ may be upper or lower case.+--+-- This parser does not accept a leading @\"0x\"@ string.+hexadecimal :: (Integral a, Bits a) => Parser a+hexadecimal = B8.foldl' step 0 `fmap` I.takeWhile1 isHexDigit+  where+    isHexDigit w = (w >= 48 && w <= 57) ||+                   (w >= 97 && w <= 102) ||+                   (w >= 65 && w <= 70)+    step a w | w >= 48 && w <= 57  = (a `shiftL` 4) .|. fromIntegral (w - 48)+             | w >= 97             = (a `shiftL` 4) .|. fromIntegral (w - 87)+             | otherwise           = (a `shiftL` 4) .|. fromIntegral (w - 55)+{-# SPECIALISE hexadecimal :: Parser Int #-}+{-# SPECIALISE hexadecimal :: Parser Int8 #-}+{-# SPECIALISE hexadecimal :: Parser Int16 #-}+{-# SPECIALISE hexadecimal :: Parser Int32 #-}+{-# SPECIALISE hexadecimal :: Parser Int64 #-}+{-# SPECIALISE hexadecimal :: Parser Integer #-}+{-# SPECIALISE hexadecimal :: Parser Word #-}+{-# SPECIALISE hexadecimal :: Parser Word8 #-}+{-# SPECIALISE hexadecimal :: Parser Word16 #-}+{-# SPECIALISE hexadecimal :: Parser Word32 #-}+{-# SPECIALISE hexadecimal :: Parser Word64 #-}++-- | Parse and decode an unsigned decimal number.+decimal :: Integral a => Parser a+decimal = B8.foldl' step 0 `fmap` I.takeWhile1 isDigit_w8+  where step a w = a * 10 + fromIntegral (w - 48)+{-# SPECIALISE decimal :: Parser Int #-}+{-# SPECIALISE decimal :: Parser Int8 #-}+{-# SPECIALISE decimal :: Parser Int16 #-}+{-# SPECIALISE decimal :: Parser Int32 #-}+{-# SPECIALISE decimal :: Parser Int64 #-}+{-# SPECIALISE decimal :: Parser Integer #-}+{-# SPECIALISE decimal :: Parser Word #-}+{-# SPECIALISE decimal :: Parser Word8 #-}+{-# SPECIALISE decimal :: Parser Word16 #-}+{-# SPECIALISE decimal :: Parser Word32 #-}+{-# SPECIALISE decimal :: Parser Word64 #-}++-- | Parse a number with an optional leading @\'+\'@ or @\'-\'@ sign+-- character.+signed :: Num a => Parser a -> Parser a+{-# SPECIALISE signed :: Parser Int -> Parser Int #-}+{-# SPECIALISE signed :: Parser Int8 -> Parser Int8 #-}+{-# SPECIALISE signed :: Parser Int16 -> Parser Int16 #-}+{-# SPECIALISE signed :: Parser Int32 -> Parser Int32 #-}+{-# SPECIALISE signed :: Parser Int64 -> Parser Int64 #-}+{-# SPECIALISE signed :: Parser Integer -> Parser Integer #-}+signed p = (negate <$> (char8 '-' *> p))+       <|> (char8 '+' *> p)+       <|> p+
+ haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString/FastSet.hs view
@@ -0,0 +1,115 @@+{-# LANGUAGE BangPatterns, MagicHash #-}++-----------------------------------------------------------------------------+-- |+-- Module      :  Data.Attoparsec.ByteString.FastSet+-- Copyright   :  Bryan O'Sullivan 2007-2015+-- License     :  BSD3+--+-- Maintainer  :  bos@serpentine.com+-- Stability   :  experimental+-- Portability :  unknown+--+-- Fast set membership tests for 'Word8' and 8-bit 'Char' values.  The+-- set representation is unboxed for efficiency.  For small sets, we+-- test for membership using a binary search.  For larger sets, we use+-- a lookup table.+--+-----------------------------------------------------------------------------+module Data.Attoparsec.ByteString.FastSet+    (+    -- * Data type+      FastSet+    -- * Construction+    , fromList+    , set+    -- * Lookup+    , memberChar+    , memberWord8+    -- * Debugging+    , fromSet+    -- * Handy interface+    , charClass+    ) where++import Data.Bits ((.&.), (.|.))+import Foreign.Storable (peekByteOff, pokeByteOff)+import GHC.Base (Int(I#), iShiftRA#, narrow8Word#, shiftL#)+import GHC.Word (Word8(W8#))+import qualified Data.ByteString as B+import qualified Data.ByteString.Char8 as B8+import qualified Data.ByteString.Internal as I+import qualified Data.ByteString.Unsafe as U++data FastSet = Sorted { fromSet :: !B.ByteString }+             | Table  { fromSet :: !B.ByteString }+    deriving (Eq, Ord)++instance Show FastSet where+    show (Sorted s) = "FastSet Sorted " ++ show (B8.unpack s)+    show (Table _) = "FastSet Table"++-- | The lower bound on the size of a lookup table.  We choose this to+-- balance table density against performance.+tableCutoff :: Int+tableCutoff = 8++-- | Create a set.+set :: B.ByteString -> FastSet+set s | B.length s < tableCutoff = Sorted . B.sort $ s+      | otherwise                = Table . mkTable $ s++fromList :: [Word8] -> FastSet+fromList = set . B.pack++data I = I {-# UNPACK #-} !Int {-# UNPACK #-} !Word8++shiftR :: Int -> Int -> Int+shiftR (I# x#) (I# i#) = I# (x# `iShiftRA#` i#)++shiftL :: Word8 -> Int -> Word8+shiftL (W8# x#) (I# i#) = W8# (narrow8Word# (x# `shiftL#` i#))++index :: Int -> I+index i = I (i `shiftR` 3) (1 `shiftL` (i .&. 7))+{-# INLINE index #-}++-- | Check the set for membership.+memberWord8 :: Word8 -> FastSet -> Bool+memberWord8 w (Table t)  =+    let I byte bit = index (fromIntegral w)+    in  U.unsafeIndex t byte .&. bit /= 0+memberWord8 w (Sorted s) = search 0 (B.length s - 1)+    where search lo hi+              | hi < lo = False+              | otherwise =+                  let mid = (lo + hi) `quot` 2+                  in case compare w (U.unsafeIndex s mid) of+                       GT -> search (mid + 1) hi+                       LT -> search lo (mid - 1)+                       _ -> True++-- | Check the set for membership.  Only works with 8-bit characters:+-- characters above code point 255 will give wrong answers.+memberChar :: Char -> FastSet -> Bool+memberChar c = memberWord8 (I.c2w c)+{-# INLINE memberChar #-}++mkTable :: B.ByteString -> B.ByteString+mkTable s = I.unsafeCreate 32 $ \t -> do+            _ <- I.memset t 0 32+            U.unsafeUseAsCStringLen s $ \(p, l) ->+              let loop n | n == l = return ()+                         | otherwise = do+                    c <- peekByteOff p n :: IO Word8+                    let I byte bit = index (fromIntegral c)+                    prev <- peekByteOff t byte :: IO Word8+                    pokeByteOff t byte (prev .|. bit)+                    loop (n + 1)+              in loop 0++charClass :: String -> FastSet+charClass = set . B8.pack . go+    where go (a:'-':b:xs) = [a..b] ++ go xs+          go (x:xs) = x : go xs+          go _ = ""
+ haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString/Internal.hs view
@@ -0,0 +1,536 @@+{-# LANGUAGE BangPatterns, CPP, GADTs, OverloadedStrings, RankNTypes,+    RecordWildCards #-}+-- |+-- Module      :  Data.Attoparsec.ByteString.Internal+-- Copyright   :  Bryan O'Sullivan 2007-2015+-- License     :  BSD3+--+-- Maintainer  :  bos@serpentine.com+-- Stability   :  experimental+-- Portability :  unknown+--+-- Simple, efficient parser combinators for 'ByteString' strings,+-- loosely based on the Parsec library.++module Data.Attoparsec.ByteString.Internal+    (+    -- * Parser types+      Parser+    , Result++    -- * Running parsers+    , parse+    , parseOnly++    -- * Combinators+    , module Data.Attoparsec.Combinator++    -- * Parsing individual bytes+    , satisfy+    , satisfyWith+    , anyWord8+    , skip+    , word8+    , notWord8++    -- ** Lookahead+    , peekWord8+    , peekWord8'++    -- ** Byte classes+    , inClass+    , notInClass++    -- * Parsing more complicated structures+    , storable++    -- * Efficient string handling+    , skipWhile+    , string+    , stringCI+    , take+    , scan+    , runScanner+    , takeWhile+    , takeWhile1+    , takeTill++    -- ** Consume all remaining input+    , takeByteString+    , takeLazyByteString++    -- * Utilities+    , endOfLine+    , endOfInput+    , match+    , atEnd+    ) where++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative ((<$>))+#endif+import Control.Applicative ((<|>))+import Control.Monad (when)+import Data.Attoparsec.ByteString.Buffer (Buffer, buffer)+import Data.Attoparsec.ByteString.FastSet (charClass, memberWord8)+import Data.Attoparsec.Combinator ((<?>))+import Data.Attoparsec.Internal+import Data.Attoparsec.Internal.Fhthagn (inlinePerformIO)+import Data.Attoparsec.Internal.Types hiding (Parser, Failure, Success)+import Data.ByteString (ByteString)+import Data.List (intercalate)+import Data.Word (Word8)+import Foreign.ForeignPtr (withForeignPtr)+import Foreign.Ptr (castPtr, minusPtr, plusPtr)+import Foreign.Storable (Storable(peek, sizeOf))+import Prelude hiding (getChar, succ, take, takeWhile)+import qualified Data.Attoparsec.ByteString.Buffer as Buf+import qualified Data.Attoparsec.Internal.Types as T+import qualified Data.ByteString as B8+import qualified Data.ByteString.Char8 as B+import qualified Data.ByteString.Internal as B+import qualified Data.ByteString.Lazy as L+import qualified Data.ByteString.Unsafe as B++type Parser = T.Parser ByteString+type Result = IResult ByteString+type Failure r = T.Failure ByteString Buffer r+type Success a r = T.Success ByteString Buffer a r++-- | The parser @satisfy p@ succeeds for any byte for which the+-- predicate @p@ returns 'True'. Returns the byte that is actually+-- parsed.+--+-- >digit = satisfy isDigit+-- >    where isDigit w = w >= 48 && w <= 57+satisfy :: (Word8 -> Bool) -> Parser Word8+satisfy p = do+  h <- peekWord8'+  if p h+    then advance 1 >> return h+    else fail "satisfy"+{-# INLINE satisfy #-}++-- | The parser @skip p@ succeeds for any byte for which the predicate+-- @p@ returns 'True'.+--+-- >skipDigit = skip isDigit+-- >    where isDigit w = w >= 48 && w <= 57+skip :: (Word8 -> Bool) -> Parser ()+skip p = do+  h <- peekWord8'+  if p h+    then advance 1+    else fail "skip"++-- | The parser @satisfyWith f p@ transforms a byte, and succeeds if+-- the predicate @p@ returns 'True' on the transformed value. The+-- parser returns the transformed byte that was parsed.+satisfyWith :: (Word8 -> a) -> (a -> Bool) -> Parser a+satisfyWith f p = do+  h <- peekWord8'+  let c = f h+  if p c+    then advance 1 >> return c+    else fail "satisfyWith"+{-# INLINE satisfyWith #-}++storable :: Storable a => Parser a+storable = hack undefined+ where+  hack :: Storable b => b -> Parser b+  hack dummy = do+    (fp,o,_) <- B.toForeignPtr `fmap` take (sizeOf dummy)+    return . inlinePerformIO . withForeignPtr fp $ \p ->+        peek (castPtr $ p `plusPtr` o)++-- | Consume exactly @n@ bytes of input.+take :: Int -> Parser ByteString+take n0 = do+  let n = max n0 0+  s <- ensure n+  advance n >> return s+{-# INLINE take #-}++-- | @string s@ parses a sequence of bytes that identically match+-- @s@. Returns the parsed string (i.e. @s@).  This parser consumes no+-- input if it fails (even if a partial match).+--+-- /Note/: The behaviour of this parser is different to that of the+-- similarly-named parser in Parsec, as this one is all-or-nothing.+-- To illustrate the difference, the following parser will fail under+-- Parsec given an input of @\"for\"@:+--+-- >string "foo" <|> string "for"+--+-- The reason for its failure is that the first branch is a+-- partial match, and will consume the letters @\'f\'@ and @\'o\'@+-- before failing.  In attoparsec, the above parser will /succeed/ on+-- that input, because the failed first branch will consume nothing.+string :: ByteString -> Parser ByteString+string s = string_ (stringSuspended id) id s+{-# INLINE string #-}++-- ASCII-specific but fast, oh yes.+toLower :: Word8 -> Word8+toLower w | w >= 65 && w <= 90 = w + 32+          | otherwise          = w++-- | Satisfy a literal string, ignoring case.+stringCI :: ByteString -> Parser ByteString+stringCI s = string_ (stringSuspended lower) lower s+  where lower = B8.map toLower+{-# INLINE stringCI #-}++string_ :: (forall r. ByteString -> ByteString -> Buffer -> Pos -> More+            -> Failure r -> Success ByteString r -> Result r)+        -> (ByteString -> ByteString)+        -> ByteString -> Parser ByteString+string_ suspended f s0 = T.Parser $ \t pos more lose succ ->+  let n = B.length s+      s = f s0+  in if lengthAtLeast pos n t+     then let t' = substring pos (Pos n) t+          in if s == f t'+             then succ t (pos + Pos n) more t'+             else lose t pos more [] "string"+     else let t' = Buf.unsafeDrop (fromPos pos) t+          in if f t' `B.isPrefixOf` s+             then suspended s (B.drop (B.length t') s) t pos more lose succ+             else lose t pos more [] "string"+{-# INLINE string_ #-}++stringSuspended :: (ByteString -> ByteString)+                -> ByteString -> ByteString -> Buffer -> Pos -> More+                -> Failure r+                -> Success ByteString r+                -> Result r+stringSuspended f s0 s t pos more lose succ =+    runParser (demandInput_ >>= go) t pos more lose succ+  where go s'0   = T.Parser $ \t' pos' more' lose' succ' ->+          let m  = B.length s+              s' = f s'0+              n  = B.length s'+          in if n >= m+             then if B.unsafeTake m s' == s+                  then let o = Pos (B.length s0)+                       in succ' t' (pos' + o) more'+                          (substring pos' o t')+                  else lose' t' pos' more' [] "string"+             else if s' == B.unsafeTake n s+                  then stringSuspended f s0 (B.unsafeDrop n s)+                       t' pos' more' lose' succ'+                  else lose' t' pos' more' [] "string"++-- | Skip past input for as long as the predicate returns 'True'.+skipWhile :: (Word8 -> Bool) -> Parser ()+skipWhile p = go+ where+  go = do+    t <- B8.takeWhile p <$> get+    continue <- inputSpansChunks (B.length t)+    when continue go+{-# INLINE skipWhile #-}++-- | Consume input as long as the predicate returns 'False'+-- (i.e. until it returns 'True'), and return the consumed input.+--+-- This parser does not fail.  It will return an empty string if the+-- predicate returns 'True' on the first byte of input.+--+-- /Note/: Because this parser does not fail, do not use it with+-- combinators such as 'Control.Applicative.many', because such+-- parsers loop until a failure occurs.  Careless use will thus result+-- in an infinite loop.+takeTill :: (Word8 -> Bool) -> Parser ByteString+takeTill p = takeWhile (not . p)+{-# INLINE takeTill #-}++-- | Consume input as long as the predicate returns 'True', and return+-- the consumed input.+--+-- This parser does not fail.  It will return an empty string if the+-- predicate returns 'False' on the first byte of input.+--+-- /Note/: Because this parser does not fail, do not use it with+-- combinators such as 'Control.Applicative.many', because such+-- parsers loop until a failure occurs.  Careless use will thus result+-- in an infinite loop.+takeWhile :: (Word8 -> Bool) -> Parser ByteString+takeWhile p = do+    s <- B8.takeWhile p <$> get+    continue <- inputSpansChunks (B.length s)+    if continue+      then takeWhileAcc p [s]+      else return s+{-# INLINE takeWhile #-}++takeWhileAcc :: (Word8 -> Bool) -> [ByteString] -> Parser ByteString+takeWhileAcc p = go+ where+  go acc = do+    s <- B8.takeWhile p <$> get+    continue <- inputSpansChunks (B.length s)+    if continue+      then go (s:acc)+      else return $ concatReverse (s:acc)+{-# INLINE takeWhileAcc #-}++takeRest :: Parser [ByteString]+takeRest = go []+ where+  go acc = do+    input <- wantInput+    if input+      then do+        s <- get+        advance (B.length s)+        go (s:acc)+      else return (reverse acc)++-- | Consume all remaining input and return it as a single string.+takeByteString :: Parser ByteString+takeByteString = B.concat `fmap` takeRest++-- | Consume all remaining input and return it as a single string.+takeLazyByteString :: Parser L.ByteString+takeLazyByteString = L.fromChunks `fmap` takeRest++data T s = T {-# UNPACK #-} !Int s++scan_ :: (s -> [ByteString] -> Parser r) -> s -> (s -> Word8 -> Maybe s)+         -> Parser r+scan_ f s0 p = go [] s0+ where+  go acc s1 = do+    let scanner (B.PS fp off len) =+          withForeignPtr fp $ \ptr0 -> do+            let start = ptr0 `plusPtr` off+                end   = start `plusPtr` len+                inner ptr !s+                  | ptr < end = do+                    w <- peek ptr+                    case p s w of+                      Just s' -> inner (ptr `plusPtr` 1) s'+                      _       -> done (ptr `minusPtr` start) s+                  | otherwise = done (ptr `minusPtr` start) s+                done !i !s = return (T i s)+            inner start s1+    bs <- get+    let T i s' = inlinePerformIO $ scanner bs+        !h = B.unsafeTake i bs+    continue <- inputSpansChunks i+    if continue+      then go (h:acc) s'+      else f s' (h:acc)+{-# INLINE scan_ #-}++-- | A stateful scanner.  The predicate consumes and transforms a+-- state argument, and each transformed state is passed to successive+-- invocations of the predicate on each byte of the input until one+-- returns 'Nothing' or the input ends.+--+-- This parser does not fail.  It will return an empty string if the+-- predicate returns 'Nothing' on the first byte of input.+--+-- /Note/: Because this parser does not fail, do not use it with+-- combinators such as 'Control.Applicative.many', because such+-- parsers loop until a failure occurs.  Careless use will thus result+-- in an infinite loop.+scan :: s -> (s -> Word8 -> Maybe s) -> Parser ByteString+scan = scan_ $ \_ chunks -> return $! concatReverse chunks+{-# INLINE scan #-}++-- | Like 'scan', but generalized to return the final state of the+-- scanner.+runScanner :: s -> (s -> Word8 -> Maybe s) -> Parser (ByteString, s)+runScanner = scan_ $ \s xs -> let !sx = concatReverse xs in return (sx, s)+{-# INLINE runScanner #-}++-- | Consume input as long as the predicate returns 'True', and return+-- the consumed input.+--+-- This parser requires the predicate to succeed on at least one byte+-- of input: it will fail if the predicate never returns 'True' or if+-- there is no input left.+takeWhile1 :: (Word8 -> Bool) -> Parser ByteString+takeWhile1 p = do+  (`when` demandInput) =<< endOfChunk+  s <- B8.takeWhile p <$> get+  let len = B.length s+  if len == 0+    then fail "takeWhile1"+    else do+      advance len+      eoc <- endOfChunk+      if eoc+        then takeWhileAcc p [s]+        else return s+{-# INLINE takeWhile1 #-}++-- | Match any byte in a set.+--+-- >vowel = inClass "aeiou"+--+-- Range notation is supported.+--+-- >halfAlphabet = inClass "a-nA-N"+--+-- To add a literal @\'-\'@ to a set, place it at the beginning or end+-- of the string.+inClass :: String -> Word8 -> Bool+inClass s = (`memberWord8` mySet)+    where mySet = charClass s+          {-# NOINLINE mySet #-}+{-# INLINE inClass #-}++-- | Match any byte not in a set.+notInClass :: String -> Word8 -> Bool+notInClass s = not . inClass s+{-# INLINE notInClass #-}++-- | Match any byte.+anyWord8 :: Parser Word8+anyWord8 = satisfy $ const True+{-# INLINE anyWord8 #-}++-- | Match a specific byte.+word8 :: Word8 -> Parser Word8+word8 c = satisfy (== c) <?> show c+{-# INLINE word8 #-}++-- | Match any byte except the given one.+notWord8 :: Word8 -> Parser Word8+notWord8 c = satisfy (/= c) <?> "not " ++ show c+{-# INLINE notWord8 #-}++-- | Match any byte, to perform lookahead. Returns 'Nothing' if end of+-- input has been reached. Does not consume any input.+--+-- /Note/: Because this parser does not fail, do not use it with+-- combinators such as 'Control.Applicative.many', because such+-- parsers loop until a failure occurs.  Careless use will thus result+-- in an infinite loop.+peekWord8 :: Parser (Maybe Word8)+peekWord8 = T.Parser $ \t pos@(Pos pos_) more _lose succ ->+  case () of+    _| pos_ < Buf.length t ->+       let !w = Buf.unsafeIndex t pos_+       in succ t pos more (Just w)+     | more == Complete ->+       succ t pos more Nothing+     | otherwise ->+       let succ' t' pos' more' = let !w = Buf.unsafeIndex t' pos_+                                 in succ t' pos' more' (Just w)+           lose' t' pos' more' = succ t' pos' more' Nothing+       in prompt t pos more lose' succ'+{-# INLINE peekWord8 #-}++-- | Match any byte, to perform lookahead.  Does not consume any+-- input, but will fail if end of input has been reached.+peekWord8' :: Parser Word8+peekWord8' = T.Parser $ \t pos more lose succ ->+    if lengthAtLeast pos 1 t+    then succ t pos more (Buf.unsafeIndex t (fromPos pos))+    else let succ' t' pos' more' bs' = succ t' pos' more' $! B.unsafeHead bs'+         in ensureSuspended 1 t pos more lose succ'+{-# INLINE peekWord8' #-}++-- | Match either a single newline character @\'\\n\'@, or a carriage+-- return followed by a newline character @\"\\r\\n\"@.+endOfLine :: Parser ()+endOfLine = (word8 10 >> return ()) <|> (string "\r\n" >> return ())++-- | Terminal failure continuation.+failK :: Failure a+failK t (Pos pos) _more stack msg = Fail (Buf.unsafeDrop pos t) stack msg+{-# INLINE failK #-}++-- | Terminal success continuation.+successK :: Success a a+successK t (Pos pos) _more a = Done (Buf.unsafeDrop pos t) a+{-# INLINE successK #-}++-- | Run a parser.+parse :: Parser a -> ByteString -> Result a+parse m s = T.runParser m (buffer s) (Pos 0) Incomplete failK successK+{-# INLINE parse #-}++-- | Run a parser that cannot be resupplied via a 'Partial' result.+--+-- This function does not force a parser to consume all of its input.+-- Instead, any residual input will be discarded.  To force a parser+-- to consume all of its input, use something like this:+--+-- @+--'parseOnly' (myParser 'Control.Applicative.<*' 'endOfInput')+-- @+parseOnly :: Parser a -> ByteString -> Either String a+parseOnly m s = case T.runParser m (buffer s) (Pos 0) Complete failK successK of+                  Fail _ [] err   -> Left err+                  Fail _ ctxs err -> Left (intercalate " > " ctxs ++ ": " ++ err)+                  Done _ a        -> Right a+                  _               -> error "parseOnly: impossible error!"+{-# INLINE parseOnly #-}++get :: Parser ByteString+get = T.Parser $ \t pos more _lose succ ->+  succ t pos more (Buf.unsafeDrop (fromPos pos) t)+{-# INLINE get #-}++endOfChunk :: Parser Bool+endOfChunk = T.Parser $ \t pos more _lose succ ->+  succ t pos more (fromPos pos == Buf.length t)+{-# INLINE endOfChunk #-}++inputSpansChunks :: Int -> Parser Bool+inputSpansChunks i = T.Parser $ \t pos_ more _lose succ ->+  let pos = pos_ + Pos i+  in if fromPos pos < Buf.length t || more == Complete+     then succ t pos more False+     else let lose' t' pos' more' = succ t' pos' more' False+              succ' t' pos' more' = succ t' pos' more' True+          in prompt t pos more lose' succ'+{-# INLINE inputSpansChunks #-}++advance :: Int -> Parser ()+advance n = T.Parser $ \t pos more _lose succ ->+  succ t (pos + Pos n) more ()+{-# INLINE advance #-}++ensureSuspended :: Int -> Buffer -> Pos -> More+                -> Failure r+                -> Success ByteString r+                -> Result r+ensureSuspended n t pos more lose succ =+    runParser (demandInput >> go) t pos more lose succ+  where go = T.Parser $ \t' pos' more' lose' succ' ->+          if lengthAtLeast pos' n t'+          then succ' t' pos' more' (substring pos (Pos n) t')+          else runParser (demandInput >> go) t' pos' more' lose' succ'++-- | If at least @n@ elements of input are available, return the+-- current input, otherwise fail.+ensure :: Int -> Parser ByteString+ensure n = T.Parser $ \t pos more lose succ ->+    if lengthAtLeast pos n t+    then succ t pos more (substring pos (Pos n) t)+    -- The uncommon case is kept out-of-line to reduce code size:+    else ensureSuspended n t pos more lose succ+{-# INLINE ensure #-}++-- | Return both the result of a parse and the portion of the input+-- that was consumed while it was being parsed.+match :: Parser a -> Parser (ByteString, a)+match p = T.Parser $ \t pos more lose succ ->+  let succ' t' pos' more' a =+        succ t' pos' more' (substring pos (pos'-pos) t', a)+  in runParser p t pos more lose succ'++lengthAtLeast :: Pos -> Int -> Buffer -> Bool+lengthAtLeast (Pos pos) n bs = Buf.length bs >= pos + n+{-# INLINE lengthAtLeast #-}++substring :: Pos -> Pos -> Buffer -> ByteString+substring (Pos pos) (Pos n) = Buf.substring pos n+{-# INLINE substring #-}
+ haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Combinator.hs view
@@ -0,0 +1,233 @@+{-# LANGUAGE BangPatterns, CPP #-}+#if __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-} -- Imports internal modules+#endif+-- |+-- Module      :  Data.Attoparsec.Combinator+-- Copyright   :  Daan Leijen 1999-2001, Bryan O'Sullivan 2007-2015+-- License     :  BSD3+--+-- Maintainer  :  bos@serpentine.com+-- Stability   :  experimental+-- Portability :  portable+--+-- Useful parser combinators, similar to those provided by Parsec.+module Data.Attoparsec.Combinator+    (+    -- * Combinators+      try+    , (<?>)+    , choice+    , count+    , option+    , many'+    , many1+    , many1'+    , manyTill+    , manyTill'+    , sepBy+    , sepBy'+    , sepBy1+    , sepBy1'+    , skipMany+    , skipMany1+    , eitherP+    , feed+    , satisfyElem+    , endOfInput+    , atEnd+    , lookAhead+    ) where++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative (Applicative(..), (<$>))+import Data.Monoid (Monoid(mappend))+#endif+import Control.Applicative (Alternative(..), empty, liftA2, many, (<|>))+import Control.Monad (MonadPlus(..))+import Data.Attoparsec.Internal.Types (Parser(..), IResult(..))+import Data.Attoparsec.Internal (endOfInput, atEnd, satisfyElem)+import Data.ByteString (ByteString)+import Prelude hiding (succ)++-- | Attempt a parse, and if it fails, rewind the input so that no+-- input appears to have been consumed.+--+-- This combinator is provided for compatibility with Parsec.+-- attoparsec parsers always backtrack on failure.+try :: Parser i a -> Parser i a+try p = p+{-# INLINE try #-}++-- | Name the parser, in case failure occurs.+(<?>) :: Parser i a+      -> String                 -- ^ the name to use if parsing fails+      -> Parser i a+p <?> msg0 = Parser $ \t pos more lose succ ->+             let lose' t' pos' more' strs msg = lose t' pos' more' (msg0:strs) msg+             in runParser p t pos more lose' succ+{-# INLINE (<?>) #-}+infix 0 <?>++-- | @choice ps@ tries to apply the actions in the list @ps@ in order,+-- until one of them succeeds. Returns the value of the succeeding+-- action.+choice :: Alternative f => [f a] -> f a+choice = foldr (<|>) empty+{-# SPECIALIZE choice :: [Parser ByteString a]+                      -> Parser ByteString a #-}++-- | @option x p@ tries to apply action @p@. If @p@ fails without+-- consuming input, it returns the value @x@, otherwise the value+-- returned by @p@.+--+-- > priority  = option 0 (digitToInt <$> digit)+option :: Alternative f => a -> f a -> f a+option x p = p <|> pure x+{-# SPECIALIZE option :: a -> Parser ByteString a -> Parser ByteString a #-}++-- | A version of 'liftM2' that is strict in the result of its first+-- action.+liftM2' :: (Monad m) => (a -> b -> c) -> m a -> m b -> m c+liftM2' f a b = do+  !x <- a+  y <- b+  return (f x y)+{-# INLINE liftM2' #-}++-- | @many' p@ applies the action @p@ /zero/ or more times. Returns a+-- list of the returned values of @p@. The value returned by @p@ is+-- forced to WHNF.+--+-- >  word  = many' letter+many' :: (MonadPlus m) => m a -> m [a]+many' p = many_p+  where many_p = some_p `mplus` return []+        some_p = liftM2' (:) p many_p+{-# INLINE many' #-}++-- | @many1 p@ applies the action @p@ /one/ or more times. Returns a+-- list of the returned values of @p@.+--+-- >  word  = many1 letter+many1 :: Alternative f => f a -> f [a]+many1 p = liftA2 (:) p (many p)+{-# INLINE many1 #-}++-- | @many1' p@ applies the action @p@ /one/ or more times. Returns a+-- list of the returned values of @p@. The value returned by @p@ is+-- forced to WHNF.+--+-- >  word  = many1' letter+many1' :: (MonadPlus m) => m a -> m [a]+many1' p = liftM2' (:) p (many' p)+{-# INLINE many1' #-}++-- | @sepBy p sep@ applies /zero/ or more occurrences of @p@, separated+-- by @sep@. Returns a list of the values returned by @p@.+--+-- > commaSep p  = p `sepBy` (char ',')+sepBy :: Alternative f => f a -> f s -> f [a]+sepBy p s = liftA2 (:) p ((s *> sepBy1 p s) <|> pure []) <|> pure []+{-# SPECIALIZE sepBy :: Parser ByteString a -> Parser ByteString s+                     -> Parser ByteString [a] #-}++-- | @sepBy' p sep@ applies /zero/ or more occurrences of @p@, separated+-- by @sep@. Returns a list of the values returned by @p@. The value+-- returned by @p@ is forced to WHNF.+--+-- > commaSep p  = p `sepBy'` (char ',')+sepBy' :: (MonadPlus m) => m a -> m s -> m [a]+sepBy' p s = scan `mplus` return []+  where scan = liftM2' (:) p ((s >> sepBy1' p s) `mplus` return [])+{-# SPECIALIZE sepBy' :: Parser ByteString a -> Parser ByteString s+                      -> Parser ByteString [a] #-}++-- | @sepBy1 p sep@ applies /one/ or more occurrences of @p@, separated+-- by @sep@. Returns a list of the values returned by @p@.+--+-- > commaSep p  = p `sepBy1` (char ',')+sepBy1 :: Alternative f => f a -> f s -> f [a]+sepBy1 p s = scan+    where scan = liftA2 (:) p ((s *> scan) <|> pure [])+{-# SPECIALIZE sepBy1 :: Parser ByteString a -> Parser ByteString s+                      -> Parser ByteString [a] #-}++-- | @sepBy1' p sep@ applies /one/ or more occurrences of @p@, separated+-- by @sep@. Returns a list of the values returned by @p@. The value+-- returned by @p@ is forced to WHNF.+--+-- > commaSep p  = p `sepBy1'` (char ',')+sepBy1' :: (MonadPlus m) => m a -> m s -> m [a]+sepBy1' p s = scan+    where scan = liftM2' (:) p ((s >> scan) `mplus` return [])+{-# SPECIALIZE sepBy1' :: Parser ByteString a -> Parser ByteString s+                       -> Parser ByteString [a] #-}++-- | @manyTill p end@ applies action @p@ /zero/ or more times until+-- action @end@ succeeds, and returns the list of values returned by+-- @p@.  This can be used to scan comments:+--+-- >  simpleComment   = string "<!--" *> manyTill anyChar (string "-->")+--+-- (Note the overlapping parsers @anyChar@ and @string \"-->\"@.+-- While this will work, it is not very efficient, as it will cause a+-- lot of backtracking.)+manyTill :: Alternative f => f a -> f b -> f [a]+manyTill p end = scan+    where scan = (end *> pure []) <|> liftA2 (:) p scan+{-# SPECIALIZE manyTill :: Parser ByteString a -> Parser ByteString b+                        -> Parser ByteString [a] #-}++-- | @manyTill' p end@ applies action @p@ /zero/ or more times until+-- action @end@ succeeds, and returns the list of values returned by+-- @p@.  This can be used to scan comments:+--+-- >  simpleComment   = string "<!--" *> manyTill' anyChar (string "-->")+--+-- (Note the overlapping parsers @anyChar@ and @string \"-->\"@.+-- While this will work, it is not very efficient, as it will cause a+-- lot of backtracking.)+--+-- The value returned by @p@ is forced to WHNF.+manyTill' :: (MonadPlus m) => m a -> m b -> m [a]+manyTill' p end = scan+    where scan = (end >> return []) `mplus` liftM2' (:) p scan+{-# SPECIALIZE manyTill' :: Parser ByteString a -> Parser ByteString b+                         -> Parser ByteString [a] #-}++-- | Skip zero or more instances of an action.+skipMany :: Alternative f => f a -> f ()+skipMany p = scan+    where scan = (p *> scan) <|> pure ()+{-# SPECIALIZE skipMany :: Parser ByteString a -> Parser ByteString () #-}++-- | Skip one or more instances of an action.+skipMany1 :: Alternative f => f a -> f ()+skipMany1 p = p *> skipMany p+{-# SPECIALIZE skipMany1 :: Parser ByteString a -> Parser ByteString () #-}++-- | Apply the given action repeatedly, returning every result.+count :: Monad m => Int -> m a -> m [a]+count n p = sequence (replicate n p)+{-# INLINE count #-}++-- | Combine two alternatives.+eitherP :: (Alternative f) => f a -> f b -> f (Either a b)+eitherP a b = (Left <$> a) <|> (Right <$> b)+{-# INLINE eitherP #-}++-- | If a parser has returned a 'T.Partial' result, supply it with more+-- input.+feed :: Monoid i => IResult i r -> i -> IResult i r+feed (Fail t ctxs msg) d = Fail (mappend t d) ctxs msg+feed (Partial k) d    = k d+feed (Done t r) d     = Done (mappend t d) r+{-# INLINE feed #-}++-- | Apply a parser without consuming any input.+lookAhead :: Parser i a -> Parser i a+lookAhead p = Parser $ \t pos more lose succ ->+  let succ' t' _pos' more' = succ t' pos more'+  in runParser p t pos more lose succ'+{-# INLINE lookAhead #-}
+ haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Internal.hs view
@@ -0,0 +1,157 @@+{-# LANGUAGE BangPatterns, CPP, ScopedTypeVariables #-}+-- |+-- Module      :  Data.Attoparsec.Internal+-- Copyright   :  Bryan O'Sullivan 2007-2015+-- License     :  BSD3+--+-- Maintainer  :  bos@serpentine.com+-- Stability   :  experimental+-- Portability :  unknown+--+-- Simple, efficient parser combinators, loosely based on the Parsec+-- library.++module Data.Attoparsec.Internal+    ( compareResults+    , prompt+    , demandInput+    , demandInput_+    , wantInput+    , endOfInput+    , atEnd+    , satisfyElem+    , concatReverse+    ) where++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative ((<$>))+import Data.Monoid (Monoid, mconcat)+#endif+import Data.Attoparsec.Internal.Types+import Data.ByteString (ByteString)+import Prelude hiding (succ)++-- | Compare two 'IResult' values for equality.+--+-- If both 'IResult's are 'Partial', the result will be 'Nothing', as+-- they are incomplete and hence their equality cannot be known.+-- (This is why there is no 'Eq' instance for 'IResult'.)+compareResults :: (Eq i, Eq r) => IResult i r -> IResult i r -> Maybe Bool+compareResults (Fail t0 ctxs0 msg0) (Fail t1 ctxs1 msg1) =+    Just (t0 == t1 && ctxs0 == ctxs1 && msg0 == msg1)+compareResults (Done t0 r0) (Done t1 r1) =+    Just (t0 == t1 && r0 == r1)+compareResults (Partial _) (Partial _) = Nothing+compareResults _ _ = Just False++-- | Ask for input.  If we receive any, pass the augmented input to a+-- success continuation, otherwise to a failure continuation.+prompt :: Chunk t+       => State t -> Pos -> More+       -> (State t -> Pos -> More -> IResult t r)+       -> (State t -> Pos -> More -> IResult t r)+       -> IResult t r+prompt t pos _more lose succ = Partial $ \s ->+  if nullChunk s+  then lose t pos Complete+  else succ (pappendChunk t s) pos Incomplete+{-# SPECIALIZE prompt :: State ByteString -> Pos -> More+                      -> (State ByteString -> Pos -> More+                          -> IResult ByteString r)+                      -> (State ByteString -> Pos -> More+                          -> IResult ByteString r)+                      -> IResult ByteString r #-}++-- | Immediately demand more input via a 'Partial' continuation+-- result.+demandInput :: Chunk t => Parser t ()+demandInput = Parser $ \t pos more lose succ ->+  case more of+    Complete -> lose t pos more [] "not enough input"+    _ -> let lose' _ pos' more' = lose t pos' more' [] "not enough input"+             succ' t' pos' more' = succ t' pos' more' ()+         in prompt t pos more lose' succ'+{-# SPECIALIZE demandInput :: Parser ByteString () #-}++-- | Immediately demand more input via a 'Partial' continuation+-- result.  Return the new input.+demandInput_ :: Chunk t => Parser t t+demandInput_ = Parser $ \t pos more lose succ ->+  case more of+    Complete -> lose t pos more [] "not enough input"+    _ -> Partial $ \s ->+         if nullChunk s+         then lose t pos Complete [] "not enough input"+         else succ (pappendChunk t s) pos more s+{-# SPECIALIZE demandInput_ :: Parser ByteString ByteString #-}++-- | This parser always succeeds.  It returns 'True' if any input is+-- available either immediately or on demand, and 'False' if the end+-- of all input has been reached.+wantInput :: forall t . Chunk t => Parser t Bool+wantInput = Parser $ \t pos more _lose succ ->+  case () of+    _ | pos < atBufferEnd (undefined :: t) t -> succ t pos more True+      | more == Complete -> succ t pos more False+      | otherwise       -> let lose' t' pos' more' = succ t' pos' more' False+                               succ' t' pos' more' = succ t' pos' more' True+                           in prompt t pos more lose' succ'+{-# INLINE wantInput #-}++-- | Match only if all input has been consumed.+endOfInput :: forall t . Chunk t => Parser t ()+endOfInput = Parser $ \t pos more lose succ ->+  case () of+    _| pos < atBufferEnd (undefined :: t) t -> lose t pos more [] "endOfInput"+     | more == Complete -> succ t pos more ()+     | otherwise ->+       let lose' t' pos' more' _ctx _msg = succ t' pos' more' ()+           succ' t' pos' more' _a = lose t' pos' more' [] "endOfInput"+       in  runParser demandInput t pos more lose' succ'+{-# SPECIALIZE endOfInput :: Parser ByteString () #-}++-- | Return an indication of whether the end of input has been+-- reached.+atEnd :: Chunk t => Parser t Bool+atEnd = not <$> wantInput+{-# INLINE atEnd #-}++satisfySuspended :: forall t r . Chunk t+                 => (ChunkElem t -> Bool)+                 -> State t -> Pos -> More+                 -> Failure t (State t) r+                 -> Success t (State t) (ChunkElem t) r+                 -> IResult t r+satisfySuspended p t pos more lose succ =+    runParser (demandInput >> go) t pos more lose succ+  where go = Parser $ \t' pos' more' lose' succ' ->+          case bufferElemAt (undefined :: t) pos' t' of+            Just (e, l) | p e -> succ' t' (pos' + Pos l) more' e+                        | otherwise -> lose' t' pos' more' [] "satisfyElem"+            Nothing -> runParser (demandInput >> go) t' pos' more' lose' succ'+{-# SPECIALIZE satisfySuspended :: (ChunkElem ByteString -> Bool)+                                -> State ByteString -> Pos -> More+                                -> Failure ByteString (State ByteString) r+                                -> Success ByteString (State ByteString)+                                           (ChunkElem ByteString) r+                                -> IResult ByteString r #-}++-- | The parser @satisfyElem p@ succeeds for any chunk element for which the+-- predicate @p@ returns 'True'. Returns the element that is+-- actually parsed.+satisfyElem :: forall t . Chunk t+            => (ChunkElem t -> Bool) -> Parser t (ChunkElem t)+satisfyElem p = Parser $ \t pos more lose succ ->+    case bufferElemAt (undefined :: t) pos t of+      Just (e, l) | p e -> succ t (pos + Pos l) more e+                  | otherwise -> lose t pos more [] "satisfyElem"+      Nothing -> satisfySuspended p t pos more lose succ+{-# INLINE satisfyElem #-}++-- | Concatenate a monoid after reversing its elements.  Used to+-- glue together a series of textual chunks that have been accumulated+-- \"backwards\".+concatReverse :: Monoid m => [m] -> m+concatReverse [x] = x+concatReverse xs  = mconcat (reverse xs)+{-# INLINE concatReverse #-}
+ haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Internal/Fhthagn.hs view
@@ -0,0 +1,18 @@+{-# LANGUAGE BangPatterns, Rank2Types, OverloadedStrings,+    RecordWildCards, MagicHash, UnboxedTuples #-}++module Data.Attoparsec.Internal.Fhthagn+    (+      inlinePerformIO+    ) where++import GHC.Base (realWorld#)+import GHC.IO (IO(IO))++-- | Just like unsafePerformIO, but we inline it. Big performance gains as+-- it exposes lots of things to further inlining. /Very unsafe/. In+-- particular, you should do no memory allocation inside an+-- 'inlinePerformIO' block. On Hugs this is just @unsafePerformIO@.+inlinePerformIO :: IO a -> a+inlinePerformIO (IO m) = case m realWorld# of (# _, r #) -> r+{-# INLINE inlinePerformIO #-}
+ haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Internal/Types.hs view
@@ -0,0 +1,243 @@+{-# LANGUAGE BangPatterns, GeneralizedNewtypeDeriving, OverloadedStrings,+    Rank2Types, RecordWildCards, TypeFamilies #-}+-- |+-- Module      :  Data.Attoparsec.Internal.Types+-- Copyright   :  Bryan O'Sullivan 2007-2015+-- License     :  BSD3+--+-- Maintainer  :  bos@serpentine.com+-- Stability   :  experimental+-- Portability :  unknown+--+-- Simple, efficient parser combinators, loosely based on the Parsec+-- library.++module Data.Attoparsec.Internal.Types+    (+      Parser(..)+    , State+    , Failure+    , Success+    , Pos(..)+    , IResult(..)+    , More(..)+    , (<>)+    , Chunk(..)+    ) where++import Control.Applicative as App (Applicative(..), (<$>))+import Control.Applicative (Alternative(..))+import Control.DeepSeq (NFData(rnf))+import Control.Monad (MonadPlus(..))+import qualified Control.Monad.Fail as Fail (MonadFail(..))+import Data.Monoid as Mon (Monoid(..))+import Data.Semigroup  (Semigroup(..))+import Data.Word (Word8)+import Data.ByteString (ByteString)+import qualified Data.ByteString as BS+import Data.ByteString.Internal (w2c)+import Prelude hiding (getChar, succ)+import qualified Data.Attoparsec.ByteString.Buffer as B++newtype Pos = Pos { fromPos :: Int }+            deriving (Eq, Ord, Show, Num)++-- | The result of a parse.  This is parameterised over the type @i@+-- of string that was processed.+--+-- This type is an instance of 'Functor', where 'fmap' transforms the+-- value in a 'Done' result.+data IResult i r =+    Fail i [String] String+    -- ^ The parse failed.  The @i@ parameter is the input that had+    -- not yet been consumed when the failure occurred.  The+    -- @[@'String'@]@ is a list of contexts in which the error+    -- occurred.  The 'String' is the message describing the error, if+    -- any.+  | Partial (i -> IResult i r)+    -- ^ Supply this continuation with more input so that the parser+    -- can resume.  To indicate that no more input is available, pass+    -- an empty string to the continuation.+    --+    -- __Note__: if you get a 'Partial' result, do not call its+    -- continuation more than once.+  | Done i r+    -- ^ The parse succeeded.  The @i@ parameter is the input that had+    -- not yet been consumed (if any) when the parse succeeded.++instance (Show i, Show r) => Show (IResult i r) where+    showsPrec d ir = showParen (d > 10) $+      case ir of+        (Fail t stk msg) -> showString "Fail" . f t . f stk . f msg+        (Partial _)      -> showString "Partial _"+        (Done t r)       -> showString "Done" . f t . f r+      where f :: Show a => a -> ShowS+            f x = showChar ' ' . showsPrec 11 x++instance (NFData i, NFData r) => NFData (IResult i r) where+    rnf (Fail t stk msg) = rnf t `seq` rnf stk `seq` rnf msg+    rnf (Partial _)  = ()+    rnf (Done t r)   = rnf t `seq` rnf r+    {-# INLINE rnf #-}++instance Functor (IResult i) where+    fmap _ (Fail t stk msg) = Fail t stk msg+    fmap f (Partial k)      = Partial (fmap f . k)+    fmap f (Done t r)   = Done t (f r)++-- | The core parser type.  This is parameterised over the type @i@+-- of string being processed.+--+-- This type is an instance of the following classes:+--+-- * 'Monad', where 'fail' throws an exception (i.e. fails) with an+--   error message.+--+-- * 'Functor' and 'Applicative', which follow the usual definitions.+--+-- * 'MonadPlus', where 'mzero' fails (with no error message) and+--   'mplus' executes the right-hand parser if the left-hand one+--   fails.  When the parser on the right executes, the input is reset+--   to the same state as the parser on the left started with. (In+--   other words, attoparsec is a backtracking parser that supports+--   arbitrary lookahead.)+--+-- * 'Alternative', which follows 'MonadPlus'.+newtype Parser i a = Parser {+      runParser :: forall r.+                   State i -> Pos -> More+                -> Failure i (State i)   r+                -> Success i (State i) a r+                -> IResult i r+    }++type family State i+type instance State ByteString = B.Buffer++type Failure i t   r = t -> Pos -> More -> [String] -> String+                       -> IResult i r+type Success i t a r = t -> Pos -> More -> a -> IResult i r++-- | Have we read all available input?+data More = Complete | Incomplete+            deriving (Eq, Show)++instance Semigroup More where+    c@Complete <> _ = c+    _          <> m = m++instance Mon.Monoid More where+    mappend = (<>)+    mempty  = Incomplete++instance Monad (Parser i) where+    fail = Fail.fail+    {-# INLINE fail #-}++    return = App.pure+    {-# INLINE return #-}++    m >>= k = Parser $ \t !pos more lose succ ->+        let succ' t' !pos' more' a = runParser (k a) t' pos' more' lose succ+        in runParser m t pos more lose succ'+    {-# INLINE (>>=) #-}++    (>>) = (*>)+    {-# INLINE (>>) #-}+++instance Fail.MonadFail (Parser i) where+    fail err = Parser $ \t pos more lose _succ -> lose t pos more [] msg+      where msg = "Failed reading: " ++ err+    {-# INLINE fail #-}++plus :: Parser i a -> Parser i a -> Parser i a+plus f g = Parser $ \t pos more lose succ ->+  let lose' t' _pos' more' _ctx _msg = runParser g t' pos more' lose succ+  in runParser f t pos more lose' succ++instance MonadPlus (Parser i) where+    mzero = fail "mzero"+    {-# INLINE mzero #-}+    mplus = plus++instance Functor (Parser i) where+    fmap f p = Parser $ \t pos more lose succ ->+      let succ' t' pos' more' a = succ t' pos' more' (f a)+      in runParser p t pos more lose succ'+    {-# INLINE fmap #-}++apP :: Parser i (a -> b) -> Parser i a -> Parser i b+apP d e = do+  b <- d+  a <- e+  return (b a)+{-# INLINE apP #-}++instance Applicative (Parser i) where+    pure v = Parser $ \t pos more _lose succ -> succ t pos more v+    {-# INLINE pure #-}+    (<*>)  = apP+    {-# INLINE (<*>) #-}+    m *> k = m >>= \_ -> k+    {-# INLINE (*>) #-}+    x <* y = x >>= \a -> y >> pure a+    {-# INLINE (<*) #-}++instance Semigroup (Parser i a) where+    (<>) = plus+    {-# INLINE (<>) #-}++instance Monoid (Parser i a) where+    mempty  = fail "mempty"+    {-# INLINE mempty #-}+    mappend = (<>)+    {-# INLINE mappend #-}++instance Alternative (Parser i) where+    empty = fail "empty"+    {-# INLINE empty #-}++    (<|>) = plus+    {-# INLINE (<|>) #-}++    many v = many_v+        where many_v = some_v <|> pure []+              some_v = (:) App.<$> v <*> many_v+    {-# INLINE many #-}++    some v = some_v+      where+        many_v = some_v <|> pure []+        some_v = (:) <$> v <*> many_v+    {-# INLINE some #-}++-- | A common interface for input chunks.+class Monoid c => Chunk c where+  type ChunkElem c+  -- | Test if the chunk is empty.+  nullChunk :: c -> Bool+  -- | Append chunk to a buffer.+  pappendChunk :: State c -> c -> State c+  -- | Position at the end of a buffer. The first argument is ignored.+  atBufferEnd :: c -> State c -> Pos+  -- | Return the buffer element at the given position along with its length.+  bufferElemAt :: c -> Pos -> State c -> Maybe (ChunkElem c, Int)+  -- | Map an element to the corresponding character.+  --   The first argument is ignored.+  chunkElemToChar :: c -> ChunkElem c -> Char++instance Chunk ByteString where+  type ChunkElem ByteString = Word8+  nullChunk = BS.null+  {-# INLINE nullChunk #-}+  pappendChunk = B.pappend+  {-# INLINE pappendChunk #-}+  atBufferEnd _ = Pos . B.length+  {-# INLINE atBufferEnd #-}+  bufferElemAt _ (Pos i) buf+    | i < B.length buf = Just (B.unsafeIndex buf i, 1)+    | otherwise = Nothing+  {-# INLINE bufferElemAt #-}+  chunkElemToChar _ = w2c+  {-# INLINE chunkElemToChar #-}
+ haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Number.hs view
@@ -0,0 +1,137 @@+{-# LANGUAGE DeriveDataTypeable #-}+-- |+-- Module      :  Data.Attoparsec.Number+-- Copyright   :  Bryan O'Sullivan 2007-2015+-- License     :  BSD3+--+-- Maintainer  :  bos@serpentine.com+-- Stability   :  experimental+-- Portability :  unknown+--+-- This module is deprecated, and both the module and 'Number' type+-- will be removed in the next major release.  Use the+-- <http://hackage.haskell.org/package/scientific scientific> package+-- and the 'Data.Scientific.Scientific' type instead.+--+-- A simple number type, useful for parsing both exact and inexact+-- quantities without losing much precision.+module Data.Attoparsec.Number+    {-# DEPRECATED "This module will be removed in the next major release." #-}+    (+      Number(..)+    ) where++import Control.DeepSeq (NFData(rnf))+import Data.Data (Data)+import Data.Function (on)+import Data.Typeable (Typeable)++-- | A numeric type that can represent integers accurately, and+-- floating point numbers to the precision of a 'Double'.+--+-- /Note/: this type is deprecated, and will be removed in the next+-- major release.  Use the 'Data.Scientific.Scientific' type instead.+data Number = I !Integer+            | D {-# UNPACK #-} !Double+              deriving (Typeable, Data)+{-# DEPRECATED Number "Use Scientific instead." #-}++instance Show Number where+    show (I a) = show a+    show (D a) = show a++instance NFData Number where+    rnf (I _) = ()+    rnf (D _) = ()+    {-# INLINE rnf #-}++binop :: (Integer -> Integer -> a) -> (Double -> Double -> a)+      -> Number -> Number -> a+binop _ d (D a) (D b) = d a b+binop i _ (I a) (I b) = i a b+binop _ d (D a) (I b) = d a (fromIntegral b)+binop _ d (I a) (D b) = d (fromIntegral a) b+{-# INLINE binop #-}++instance Eq Number where+    (==) = binop (==) (==)+    {-# INLINE (==) #-}++    (/=) = binop (/=) (/=)+    {-# INLINE (/=) #-}++instance Ord Number where+    (<) = binop (<) (<)+    {-# INLINE (<) #-}++    (<=) = binop (<=) (<=)+    {-# INLINE (<=) #-}++    (>) = binop (>) (>)+    {-# INLINE (>) #-}++    (>=) = binop (>=) (>=)+    {-# INLINE (>=) #-}++    compare = binop compare compare+    {-# INLINE compare #-}++instance Num Number where+    (+) = binop (((I$!).) . (+)) (((D$!).) . (+))+    {-# INLINE (+) #-}++    (-) = binop (((I$!).) . (-)) (((D$!).) . (-))+    {-# INLINE (-) #-}++    (*) = binop (((I$!).) . (*)) (((D$!).) . (*))+    {-# INLINE (*) #-}++    abs (I a) = I $! abs a+    abs (D a) = D $! abs a+    {-# INLINE abs #-}++    negate (I a) = I $! negate a+    negate (D a) = D $! negate a+    {-# INLINE negate #-}++    signum (I a) = I $! signum a+    signum (D a) = D $! signum a+    {-# INLINE signum #-}++    fromInteger = (I$!) . fromInteger+    {-# INLINE fromInteger #-}++instance Real Number where+    toRational (I a) = fromIntegral a+    toRational (D a) = toRational a+    {-# INLINE toRational #-}++instance Fractional Number where+    fromRational = (D$!) . fromRational+    {-# INLINE fromRational #-}++    (/) = binop (((D$!).) . (/) `on` fromIntegral)+                (((D$!).) . (/))+    {-# INLINE (/) #-}++    recip (I a) = D $! recip (fromIntegral a)+    recip (D a) = D $! recip a+    {-# INLINE recip #-}++instance RealFrac Number where+    properFraction (I a) = (fromIntegral a,0)+    properFraction (D a) = case properFraction a of+                             (i,d) -> (i,D d)+    {-# INLINE properFraction #-}+    truncate (I a) = fromIntegral a+    truncate (D a) = truncate a+    {-# INLINE truncate #-}+    round (I a) = fromIntegral a+    round (D a) = round a+    {-# INLINE round #-}+    ceiling (I a) = fromIntegral a+    ceiling (D a) = ceiling a+    {-# INLINE ceiling #-}+    floor (I a) = fromIntegral a+    floor (D a) = floor a+    {-# INLINE floor #-}
haddock.cabal view
@@ -1,8 +1,28 @@ name:                 haddock-version:              2.17.5+version:              2.18.1 synopsis:             A documentation-generation tool for Haskell libraries-description:          Haddock is a documentation-generation tool for Haskell-                      libraries+description:+  This is Haddock, a tool for automatically generating documentation+  from annotated Haskell source code. It is primary intended for documenting+  library interfaces, but it should be useful for any kind of Haskell code.+  .+  Haddock lets you write documentation annotations next to the definitions of+  functions and types in the source code, in a syntax that is easy on the eye+  when writing the source code (no heavyweight mark-up).+  .+  Haddock understands Haskell's module system, so you can structure your code+  however you like without worrying that internal structure will be exposed in+  the generated documentation. For example, it is common to implement a library+  in several modules, but define the external API by having a single module+  which re-exports parts of these implementation modules. Using Haddock, you can+  still write documentation annotations next to the actual definitions of the+  functions and types in the library, but the documentation annotations from the+  implementation will be propagated to the external API when the documentation is+  generated. Abstract types and classes are handled correctly. In fact, even+  without any documentation annotations, Haddock can generate useful documentation+  from your source code.+  .+  <<https://cdn.rawgit.com/haskell/haddock/master/doc/cheatsheet/haddocks.svg>> license:              BSD3 license-file:         LICENSE author:               Simon Marlow, David Waern@@ -12,11 +32,11 @@ copyright:            (c) Simon Marlow, David Waern category:             Documentation build-type:           Simple-cabal-version:        >= 1.10-stability:            experimental+cabal-version:        >= 2.0+tested-with:          GHC==8.2.*  extra-source-files:-  CHANGES+  CHANGES.md   README.md   doc/Makefile   doc/README.md@@ -45,10 +65,9 @@    -- haddock typically only supports a single GHC major version   build-depends:-    base == 4.9.*-+    base >= 4.3 && < 4.11   if flag(in-ghc-tree)-    hs-source-dirs: haddock-api/src, haddock-library/vendor/attoparsec-0.12.1.1, haddock-library/src+    hs-source-dirs: haddock-api/src, haddock-library/vendor/attoparsec-0.13.1.0, haddock-library/src     cpp-options: -DIN_GHC_TREE     build-depends:       filepath,@@ -59,7 +78,7 @@       xhtml >= 3000.2 && < 3000.3,       Cabal >= 1.10,       ghc-boot,-      ghc >= 7.11 && < 8.1,+      ghc == 8.2.*,       bytestring,       transformers @@ -124,43 +143,58 @@   else     -- in order for haddock's advertised version number to have proper meaning,     -- we pin down to a single haddock-api version.-    build-depends:  haddock-api == 2.17.4+    build-depends:  haddock-api == 2.18.1 +    other-modules:+      ResponseFile+ test-suite driver-test   type:             exitcode-stdio-1.0   default-language: Haskell2010   main-is:          Main.hs   hs-source-dirs:   driver-test, driver+  other-modules:+    ResponseFile+    ResponseFileSpec+   build-depends:    base, hspec  test-suite html-test   type:             exitcode-stdio-1.0-  default-language: Haskell2010-  main-is:          Main.hs-  hs-source-dirs:   html-test-  build-depends:    base, filepath, haddock-test == 0.0.1+  -- This tells cabal that this test depends on the executable+  -- component 'haddock' from this very same package, as well+  -- as adding the build-folder where the `haddock`+  -- executable can be found in front of $PATH+  build-tool-depends: haddock:haddock+  default-language:   Haskell2010+  main-is:            Main.hs+  hs-source-dirs:     html-test+  build-depends:      base, filepath, haddock-test == 0.0.1  test-suite hypsrc-test-  type:             exitcode-stdio-1.0-  default-language: Haskell2010-  main-is:          Main.hs-  hs-source-dirs:   hypsrc-test-  build-depends:    base, filepath, haddock-test == 0.0.1-  ghc-options:      -Wall -fwarn-tabs+  type:               exitcode-stdio-1.0+  build-tool-depends: haddock:haddock+  default-language:   Haskell2010+  main-is:            Main.hs+  hs-source-dirs:     hypsrc-test+  build-depends:      base, filepath, haddock-test == 0.0.1+  ghc-options:        -Wall -fwarn-tabs  test-suite latex-test-  type:             exitcode-stdio-1.0-  default-language: Haskell2010-  main-is:          Main.hs-  hs-source-dirs:   latex-test-  build-depends:    base, filepath, haddock-test == 0.0.1+  type:               exitcode-stdio-1.0+  build-tool-depends: haddock:haddock+  default-language:   Haskell2010+  main-is:            Main.hs+  hs-source-dirs:     latex-test+  build-depends:      base, filepath, haddock-test == 0.0.1  test-suite hoogle-test-  type:             exitcode-stdio-1.0-  default-language: Haskell2010-  main-is:          Main.hs-  hs-source-dirs:   hoogle-test-  build-depends:    base, filepath, haddock-test == 0.0.1+  type:               exitcode-stdio-1.0+  build-tool-depends: haddock:haddock+  default-language:   Haskell2010+  main-is:            Main.hs+  hs-source-dirs:     hoogle-test+  build-depends:      base, filepath, haddock-test == 0.0.1  source-repository head   type:     git
hoogle-test/Main.hs view
@@ -1,10 +1,12 @@ {-# LANGUAGE CPP #-}  +import Data.Function import System.Environment import System.FilePath  import Test.Haddock+import Test.Haddock.Utils   checkConfig :: CheckConfig String@@ -12,7 +14,7 @@     { ccfgRead = Just     , ccfgClean = \_ -> id     , ccfgDump = id-    , ccfgEqual = (==)+    , ccfgEqual = (==) `on` crlfToLf     }  
html-test/ref/A.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_A.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/B.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_B.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bold.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bold.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug1.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug1.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug195.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug195.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug2.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug2.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug201.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug201.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug253.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug253.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug26.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug26.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug280.html view
@@ -1,4 +1,3 @@-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" ><head   ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"@@ -7,12 +6,12 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"-    >//<![CDATA[-window.onload = function () {pageLoad();setSynopsis("mini_Bug280.html");};-//]]>+    >//+window.onload = function () {pageLoad();};+// </script     ></head   ><body@@ -28,7 +27,7 @@ 	  ></li 	></ul       ><p class="caption empty"-      >&nbsp;</p+      ></p       ></div     ><div id="content"     ><div id="module-header"@@ -38,8 +37,8 @@ 	    >Copyright</th 	    ><td 	    >Foo<br-         />Bar<br-         />Baz</td+	       />Bar<br+	       />Baz</td 	    ></tr 	  ><tr 	  ><th@@ -55,9 +54,9 @@       ><p class="caption" 	>Description</p 	><div class="doc"-		><p-		>The module description</p-		></div+	><p+	  >The module description</p+	  ></div 	></div       ><div id="interface"       ><h1
html-test/ref/Bug294.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug294.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug298.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug298.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug3.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug3.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug308.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug308.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug308CrossModule.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug308CrossModule.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug310.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug310.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug313.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug313.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug335.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug335.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug387.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug387.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug4.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug4.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug6.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug6.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
+ html-test/ref/Bug647.html view
@@ -0,0 +1,114 @@+<html xmlns="http://www.w3.org/1999/xhtml"+><head+  ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"+     /><title+    >Bug647</title+    ><link href="#" rel="stylesheet" type="text/css" title="Ocean"+     /><script src="haddock-util.js" type="text/javascript"+    ></script+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ></script+    ><script type="text/javascript"+    >//+window.onload = function () {pageLoad();};+//+</script+    ></head+  ><body+  ><div id="package-header"+    ><ul class="links" id="page-menu"+      ><li+	><a href="#"+	  >Contents</a+	  ></li+	><li+	><a href="#"+	  >Index</a+	  ></li+	></ul+      ><p class="caption empty"+      ></p+      ></div+    ><div id="content"+    ><div id="module-header"+      ><table class="info"+	><tr+	  ><th+	    >Safe Haskell</th+	    ><td+	    >Safe</td+	    ></tr+	  ></table+	><p class="caption"+	>Bug647</p+	></div+      ><div id="interface"+      ><h1+	>Documentation</h1+	><div class="top"+	><p class="src"+	  ><span class="keyword"+	    >class</span+	    > <a id="t:Bug647" class="def"+	    >Bug647</a+	    > a <span class="keyword"+	    >where</span+	    > <a href="#" class="selflink"+	    >#</a+	    ></p+	  ><div class="subs minimal"+	  ><p class="caption"+	    >Minimal complete definition</p+	    ><p class="src"+	    ><a href="#"+	      >f</a+	      ></p+	    ></div+	  ><div class="subs methods"+	  ><p class="caption"+	    >Methods</p+	    ><p class="src"+	    ><a id="v:f" class="def"+	      >f</a+	      > <a href="#" class="selflink"+	      >#</a+	      ></p+	    ><div class="subs arguments"+	    ><p class="caption"+	      >Arguments</p+	      ><table+	      ><tr+		><td class="src"+		  >:: a</td+		  ><td class="doc"+		  ><p+		    >doc for arg1</p+		    ></td+		  ></tr+		><tr+		><td class="src"+		  >-&gt; a</td+		  ><td class="doc"+		  ><p+		    >doc for arg2</p+		    ></td+		  ></tr+		><tr+		><td class="src"+		  >-&gt; a</td+		  ><td class="doc"+		  ><p+		    >doc for arg3</p+		    ></td+		  ></tr+		></table+	      ></div+	    ></div+	  ></div+	></div+      ></div+    ><div id="footer"+    ></div+    ></body+  ></html+>
html-test/ref/Bug7.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug7.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bug8.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug8.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head@@ -89,7 +89,7 @@ 	><p class="src" 	  ><a id="v:-45--45--62-" class="def" 	    >(--&gt;)</a-	    > :: t -&gt; t1 -&gt; <a href="#"+	    > :: p1 -&gt; p2 -&gt; <a href="#" 	    >Typ</a 	    > <span class="fixity" 	    >infix 9</span
html-test/ref/Bug85.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bug85.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/BugDeprecated.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_BugDeprecated.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/BugExportHeadings.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_BugExportHeadings.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Bugs.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Bugs.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
+ html-test/ref/BundledPatterns.html view
@@ -0,0 +1,474 @@+<html xmlns="http://www.w3.org/1999/xhtml"+><head+  ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"+     /><title+    >BundledPatterns</title+    ><link href="#" rel="stylesheet" type="text/css" title="Ocean"+     /><script src="haddock-util.js" type="text/javascript"+    ></script+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ></script+    ><script type="text/javascript"+    >//+window.onload = function () {pageLoad();};+//+</script+    ></head+  ><body+  ><div id="package-header"+    ><ul class="links" id="page-menu"+      ><li+	><a href="#"+	  >Contents</a+	  ></li+	><li+	><a href="#"+	  >Index</a+	  ></li+	></ul+      ><p class="caption empty"+      ></p+      ></div+    ><div id="content"+    ><div id="module-header"+      ><table class="info"+	><tr+	  ><th+	    >Safe Haskell</th+	    ><td+	    >None</td+	    ></tr+	  ></table+	><p class="caption"+	>BundledPatterns</p+	></div+      ><div id="synopsis"+      ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')"+	>Synopsis</p+	><ul id="section.syn" class="hide" onclick="toggleSection('syn')"+	><li class="src short"+	  ><span class="keyword"+	    >data</span+	    > <a href="#"+	    >Vec</a+	    > :: <a href="#"+	    >Nat</a+	    > -&gt; <a href="#"+	    >*</a+	    > -&gt; <a href="#"+	    >*</a+	    > <span class="keyword"+	    >where</span+	    ><ul class="subs"+	    ><li+	      ><a href="#"+		>Nil</a+		> :: <a href="#"+		>Vec</a+		> 0 a</li+	      ><li+	      ><span class="keyword"+		>pattern</span+		> <a href="#"+		>(:&gt;)</a+		> :: a -&gt; <a href="#"+		>Vec</a+		> n a -&gt; <a href="#"+		>Vec</a+		> (n <a href="#"+		>+</a+		> 1) a</li+	      ></ul+	    ></li+	  ><li class="src short"+	  ><span class="keyword"+	    >data</span+	    > <a href="#"+	    >RTree</a+	    > :: <a href="#"+	    >Nat</a+	    > -&gt; <a href="#"+	    >*</a+	    > -&gt; <a href="#"+	    >*</a+	    > <span class="keyword"+	    >where</span+	    ><ul class="subs"+	    ><li+	      ><span class="keyword"+		>pattern</span+		> <a href="#"+		>LR</a+		> :: a -&gt; <a href="#"+		>RTree</a+		> 0 a</li+	      ><li+	      ><span class="keyword"+		>pattern</span+		> <a href="#"+		>BR</a+		> :: <a href="#"+		>RTree</a+		> d a -&gt; <a href="#"+		>RTree</a+		> d a -&gt; <a href="#"+		>RTree</a+		> (d <a href="#"+		>+</a+		> 1) a</li+	      ></ul+	    ></li+	  ></ul+	></div+      ><div id="interface"+      ><h1+	>Documentation</h1+	><div class="top"+	><p class="src"+	  ><span class="keyword"+	    >data</span+	    > <a id="t:Vec" class="def"+	    >Vec</a+	    > :: <a href="#"+	    >Nat</a+	    > -&gt; <a href="#"+	    >*</a+	    > -&gt; <a href="#"+	    >*</a+	    > <span class="keyword"+	    >where</span+	    > <a href="#" class="selflink"+	    >#</a+	    ></p+	  ><div class="doc"+	  ><p+	    >Fixed size vectors.</p+	    ><ul+	    ><li+	      >Lists with their length encoded in their type</li+	      ><li+	      ><code+		><a href="#"+		  >Vec</a+		  ></code+		>tor elements have an <strong+		>ASCENDING</strong+		> subscript starting from 0 and+   ending at <code+		><code+		  ><a href="#"+		    >length</a+		    ></code+		  > - 1</code+		>.</li+	      ></ul+	    ></div+	  ><div class="subs constructors"+	  ><p class="caption"+	    >Constructors</p+	    ><table+	    ><tr+	      ><td class="src"+		><a id="v:Nil" class="def"+		  >Nil</a+		  > :: <a href="#"+		  >Vec</a+		  > 0 a</td+		><td class="doc empty"+		></td+		></tr+	      ></table+	    ></div+	  ><div class="subs bundled-patterns"+	  ><p class="caption"+	    >Bundled Patterns</p+	    ><table+	    ><tr+	      ><td class="src"+		><span class="keyword"+		  >pattern</span+		  > <a id="v::-62-" class="def"+		  >(:&gt;)</a+		  > :: a -&gt; <a href="#"+		  >Vec</a+		  > n a -&gt; <a href="#"+		  >Vec</a+		  > (n <a href="#"+		  >+</a+		  > 1) a <span class="fixity"+		  >infixr 5</span+		  ><span class="rightedge"+		  ></span+		  ></td+		><td class="doc"+		><p+		  >Add an element to the head of a vector.</p+		  ><pre class="screen"+		  ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >3:&gt;4:&gt;5:&gt;Nil+</code+		      ></strong+		    >&lt;3,4,5&gt;+<code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >let x = 3:&gt;4:&gt;5:&gt;Nil+</code+		      ></strong+		    ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >:t x+</code+		      ></strong+		    >x :: Num a =&gt; Vec 3 a+</pre+		  ><p+		  >Can be used as a pattern:</p+		  ><pre class="screen"+		  ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >let f (x :&gt; y :&gt; _) = x + y+</code+		      ></strong+		    ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >:t f+</code+		      ></strong+		    >f :: Num a =&gt; Vec ((n + 1) + 1) a -&gt; a+<code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >f (3:&gt;4:&gt;5:&gt;6:&gt;7:&gt;Nil)+</code+		      ></strong+		    >7+</pre+		  ><p+		  >Also in conjunctions with (<code+		    >:&lt;</code+		    >):</p+		  ><pre class="screen"+		  ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >let g (a :&gt; b :&gt; (_ :&lt; y :&lt; x)) = a + b +  x + y+</code+		      ></strong+		    ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >:t g+</code+		      ></strong+		    >g :: Num a =&gt; Vec ((((n + 1) + 1) + 1) + 1) a -&gt; a+<code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >g (1:&gt;2:&gt;3:&gt;4:&gt;5:&gt;Nil)+</code+		      ></strong+		    >12+</pre+		  ></td+		></tr+	      ></table+	    ></div+	  ></div+	><div class="top"+	><p class="src"+	  ><span class="keyword"+	    >data</span+	    > <a id="t:RTree" class="def"+	    >RTree</a+	    > :: <a href="#"+	    >Nat</a+	    > -&gt; <a href="#"+	    >*</a+	    > -&gt; <a href="#"+	    >*</a+	    > <span class="keyword"+	    >where</span+	    > <a href="#" class="selflink"+	    >#</a+	    ></p+	  ><div class="doc"+	  ><p+	    >Perfect depth binary tree.</p+	    ><ul+	    ><li+	      >Only has elements at the leaf of the tree</li+	      ><li+	      >A tree of depth <em+		>d</em+		> has <em+		>2^d</em+		> elements.</li+	      ></ul+	    ></div+	  ><div class="subs bundled-patterns"+	  ><p class="caption"+	    >Bundled Patterns</p+	    ><table+	    ><tr+	      ><td class="src"+		><span class="keyword"+		  >pattern</span+		  > <a id="v:LR" class="def"+		  >LR</a+		  > :: a -&gt; <a href="#"+		  >RTree</a+		  > 0 a</td+		><td class="doc"+		><p+		  >Leaf of a perfect depth tree</p+		  ><pre class="screen"+		  ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >LR 1+</code+		      ></strong+		    >1+<code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >let x = LR 1+</code+		      ></strong+		    ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >:t x+</code+		      ></strong+		    >x :: Num a =&gt; RTree 0 a+</pre+		  ><p+		  >Can be used as a pattern:</p+		  ><pre class="screen"+		  ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >let f (LR a) (LR b) = a + b+</code+		      ></strong+		    ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >:t f+</code+		      ></strong+		    >f :: Num a =&gt; RTree 0 a -&gt; RTree 0 a -&gt; a+<code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >f (LR 1) (LR 2)+</code+		      ></strong+		    >3+</pre+		  ></td+		></tr+	      ><tr+	      ><td class="src"+		><span class="keyword"+		  >pattern</span+		  > <a id="v:BR" class="def"+		  >BR</a+		  > :: <a href="#"+		  >RTree</a+		  > d a -&gt; <a href="#"+		  >RTree</a+		  > d a -&gt; <a href="#"+		  >RTree</a+		  > (d <a href="#"+		  >+</a+		  > 1) a</td+		><td class="doc"+		><p+		  >Branch of a perfect depth tree</p+		  ><pre class="screen"+		  ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >BR (LR 1) (LR 2)+</code+		      ></strong+		    >&lt;1,2&gt;+<code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >let x = BR (LR 1) (LR 2)+</code+		      ></strong+		    ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >:t x+</code+		      ></strong+		    >x :: Num a =&gt; RTree 1 a+</pre+		  ><p+		  >Case be used a pattern:</p+		  ><pre class="screen"+		  ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >let f (BR (LR a) (LR b)) = LR (a + b)+</code+		      ></strong+		    ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >:t f+</code+		      ></strong+		    >f :: Num a =&gt; RTree 1 a -&gt; RTree 0 a+<code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >f (BR (LR 1) (LR 2))+</code+		      ></strong+		    >3+</pre+		  ></td+		></tr+	      ></table+	    ></div+	  ></div+	></div+      ></div+    ><div id="footer"+    ></div+    ></body+  ></html+>
+ html-test/ref/BundledPatterns2.html view
@@ -0,0 +1,472 @@+<html xmlns="http://www.w3.org/1999/xhtml"+><head+  ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"+     /><title+    >BundledPatterns2</title+    ><link href="#" rel="stylesheet" type="text/css" title="Ocean"+     /><script src="haddock-util.js" type="text/javascript"+    ></script+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ></script+    ><script type="text/javascript"+    >//+window.onload = function () {pageLoad();};+//+</script+    ></head+  ><body+  ><div id="package-header"+    ><ul class="links" id="page-menu"+      ><li+	><a href="#"+	  >Contents</a+	  ></li+	><li+	><a href="#"+	  >Index</a+	  ></li+	></ul+      ><p class="caption empty"+      ></p+      ></div+    ><div id="content"+    ><div id="module-header"+      ><table class="info"+	><tr+	  ><th+	    >Safe Haskell</th+	    ><td+	    >None</td+	    ></tr+	  ></table+	><p class="caption"+	>BundledPatterns2</p+	></div+      ><div id="synopsis"+      ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')"+	>Synopsis</p+	><ul id="section.syn" class="hide" onclick="toggleSection('syn')"+	><li class="src short"+	  ><span class="keyword"+	    >data</span+	    > <a href="#"+	    >Vec</a+	    > :: <a href="#"+	    >Nat</a+	    > -&gt; <a href="#"+	    >*</a+	    > -&gt; <a href="#"+	    >*</a+	    > <span class="keyword"+	    >where</span+	    ><ul class="subs"+	    ><li+	      ><span class="keyword"+		>pattern</span+		> <a href="#"+ 		>Empty</a+ 		> :: <a href="#"+ 		>Vec</a+ 		> 0 a</li+ 	      ><li+ 	      ><span class="keyword"+ 		>pattern</span+ 		> <a href="#"+		>(:&gt;)</a+		> :: a -&gt; <a href="#"+		>Vec</a+		> n a -&gt; <a href="#"+		>Vec</a+		> (n <a href="#"+		>+</a+		> 1) a</li+	      ></ul+	    ></li+	  ><li class="src short"+	  ><span class="keyword"+	    >data</span+	    > <a href="#"+	    >RTree</a+	    > :: <a href="#"+	    >Nat</a+	    > -&gt; <a href="#"+	    >*</a+	    > -&gt; <a href="#"+	    >*</a+	    > <span class="keyword"+	    >where</span+	    ><ul class="subs"+	    ><li+	      ><span class="keyword"+		>pattern</span+		> <a href="#"+		>LR</a+		> :: a -&gt; <a href="#"+		>RTree</a+		> 0 a</li+	      ><li+	      ><span class="keyword"+		>pattern</span+		> <a href="#"+		>BR</a+		> :: <a href="#"+		>RTree</a+		> d a -&gt; <a href="#"+		>RTree</a+		> d a -&gt; <a href="#"+		>RTree</a+		> (d <a href="#"+		>+</a+		> 1) a</li+	      ></ul+	    ></li+	  ></ul+	></div+      ><div id="interface"+      ><h1+	>Documentation</h1+	><div class="top"+	><p class="src"+	  ><span class="keyword"+	    >data</span+	    > <a id="t:Vec" class="def"+	    >Vec</a+	    > :: <a href="#"+	    >Nat</a+	    > -&gt; <a href="#"+	    >*</a+	    > -&gt; <a href="#"+	    >*</a+	    > <span class="keyword"+	    >where</span+	    > <a href="#" class="selflink"+	    >#</a+	    ></p+	  ><div class="doc"+	  ><p+	    >Fixed size vectors.</p+	    ><ul+	    ><li+	      >Lists with their length encoded in their type</li+	      ><li+	      ><code+		><a href="#"+		  >Vec</a+		  ></code+		>tor elements have an <strong+		>ASCENDING</strong+		> subscript starting from 0 and+   ending at <code+		><code+		  ><a href="#"+		    >length</a+		    ></code+		  > - 1</code+		>.</li+	      ></ul+	    ></div+	  ><div class="subs bundled-patterns"+	  ><p class="caption"+	    >Bundled Patterns</p+	    ><table+	    ><tr+	      ><td class="src"+		><span class="keyword"+		  >pattern</span+ 		  > <a id="v:Empty" class="def"+ 		  >Empty</a+ 		  > :: <a href="#"+ 		  >Vec</a+ 		  > 0 a</td+ 		><td class="doc empty"+ 		></td+ 		></tr+ 	      ><tr+ 	      ><td class="src"+ 		><span class="keyword"+ 		  >pattern</span+		  > <a id="v::-62-" class="def"+		  >(:&gt;)</a+		  > :: a -&gt; <a href="#"+		  >Vec</a+		  > n a -&gt; <a href="#"+		  >Vec</a+		  > (n <a href="#"+		  >+</a+		  > 1) a <span class="fixity"+		  >infixr 5</span+		  ><span class="rightedge"+		  ></span+		  ></td+		><td class="doc"+		><p+		  >Add an element to the head of a vector.</p+		  ><pre class="screen"+		  ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >3:&gt;4:&gt;5:&gt;Nil+</code+		      ></strong+		    >&lt;3,4,5&gt;+<code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >let x = 3:&gt;4:&gt;5:&gt;Nil+</code+		      ></strong+		    ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >:t x+</code+		      ></strong+		    >x :: Num a =&gt; Vec 3 a+</pre+		  ><p+		  >Can be used as a pattern:</p+		  ><pre class="screen"+		  ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >let f (x :&gt; y :&gt; _) = x + y+</code+		      ></strong+		    ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >:t f+</code+		      ></strong+		    >f :: Num a =&gt; Vec ((n + 1) + 1) a -&gt; a+<code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >f (3:&gt;4:&gt;5:&gt;6:&gt;7:&gt;Nil)+</code+		      ></strong+		    >7+</pre+		  ><p+		  >Also in conjunctions with (<code+		    >:&lt;</code+		    >):</p+		  ><pre class="screen"+		  ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >let g (a :&gt; b :&gt; (_ :&lt; y :&lt; x)) = a + b +  x + y+</code+		      ></strong+		    ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >:t g+</code+		      ></strong+		    >g :: Num a =&gt; Vec ((((n + 1) + 1) + 1) + 1) a -&gt; a+<code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >g (1:&gt;2:&gt;3:&gt;4:&gt;5:&gt;Nil)+</code+		      ></strong+		    >12+</pre+		  ></td+		></tr+	      ></table+	    ></div+	  ></div+	><div class="top"+	><p class="src"+	  ><span class="keyword"+	    >data</span+	    > <a id="t:RTree" class="def"+	    >RTree</a+	    > :: <a href="#"+	    >Nat</a+	    > -&gt; <a href="#"+	    >*</a+	    > -&gt; <a href="#"+	    >*</a+	    > <span class="keyword"+	    >where</span+	    > <a href="#" class="selflink"+	    >#</a+	    ></p+	  ><div class="doc"+	  ><p+	    >Perfect depth binary tree.</p+	    ><ul+	    ><li+	      >Only has elements at the leaf of the tree</li+	      ><li+	      >A tree of depth <em+		>d</em+		> has <em+		>2^d</em+		> elements.</li+	      ></ul+	    ></div+	  ><div class="subs bundled-patterns"+	  ><p class="caption"+	    >Bundled Patterns</p+	    ><table+	    ><tr+	      ><td class="src"+		><span class="keyword"+		  >pattern</span+		  > <a id="v:LR" class="def"+		  >LR</a+		  > :: a -&gt; <a href="#"+		  >RTree</a+		  > 0 a</td+		><td class="doc"+		><p+		  >Leaf of a perfect depth tree</p+		  ><pre class="screen"+		  ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >LR 1+</code+		      ></strong+		    >1+<code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >let x = LR 1+</code+		      ></strong+		    ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >:t x+</code+		      ></strong+		    >x :: Num a =&gt; RTree 0 a+</pre+		  ><p+		  >Can be used as a pattern:</p+		  ><pre class="screen"+		  ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >let f (LR a) (LR b) = a + b+</code+		      ></strong+		    ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >:t f+</code+		      ></strong+		    >f :: Num a =&gt; RTree 0 a -&gt; RTree 0 a -&gt; a+<code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >f (LR 1) (LR 2)+</code+		      ></strong+		    >3+</pre+		  ></td+		></tr+	      ><tr+	      ><td class="src"+		><span class="keyword"+		  >pattern</span+		  > <a id="v:BR" class="def"+		  >BR</a+		  > :: <a href="#"+		  >RTree</a+		  > d a -&gt; <a href="#"+		  >RTree</a+		  > d a -&gt; <a href="#"+		  >RTree</a+		  > (d <a href="#"+		  >+</a+		  > 1) a</td+		><td class="doc"+		><p+		  >Branch of a perfect depth tree</p+		  ><pre class="screen"+		  ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >BR (LR 1) (LR 2)+</code+		      ></strong+		    >&lt;1,2&gt;+<code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >let x = BR (LR 1) (LR 2)+</code+		      ></strong+		    ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >:t x+</code+		      ></strong+		    >x :: Num a =&gt; RTree 1 a+</pre+		  ><p+		  >Case be used a pattern:</p+		  ><pre class="screen"+		  ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >let f (BR (LR a) (LR b)) = LR (a + b)+</code+		      ></strong+		    ><code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >:t f+</code+		      ></strong+		    >f :: Num a =&gt; RTree 1 a -&gt; RTree 0 a+<code class="prompt"+		    >&gt;&gt;&gt; </code+		    ><strong class="userinput"+		    ><code+		      >f (BR (LR 1) (LR 2))+</code+		      ></strong+		    >3+</pre+		  ></td+		></tr+	      ></table+	    ></div+	  ></div+	></div+      ></div+    ><div id="footer"+    ></div+    ></body+  ></html+>
html-test/ref/DeprecatedClass.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_DeprecatedClass.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/DeprecatedData.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_DeprecatedData.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/DeprecatedFunction.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_DeprecatedFunction.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/DeprecatedFunction2.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_DeprecatedFunction2.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/DeprecatedFunction3.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_DeprecatedFunction3.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/DeprecatedModule.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_DeprecatedModule.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/DeprecatedModule2.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_DeprecatedModule2.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/DeprecatedNewtype.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_DeprecatedNewtype.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/DeprecatedReExport.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_DeprecatedReExport.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/DeprecatedRecord.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_DeprecatedRecord.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/DeprecatedTypeFamily.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_DeprecatedTypeFamily.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/DeprecatedTypeSynonym.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_DeprecatedTypeSynonym.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
+ html-test/ref/DuplicateRecordFields.html view
@@ -0,0 +1,160 @@+<html xmlns="http://www.w3.org/1999/xhtml"+><head+  ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"+     /><title+    >DuplicateRecordFields</title+    ><link href="#" rel="stylesheet" type="text/css" title="Ocean"+     /><script src="haddock-util.js" type="text/javascript"+    ></script+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ></script+    ><script type="text/javascript"+    >//+window.onload = function () {pageLoad();};+//+</script+    ></head+  ><body+  ><div id="package-header"+    ><ul class="links" id="page-menu"+      ><li+	><a href="#"+	  >Contents</a+	  ></li+	><li+	><a href="#"+	  >Index</a+	  ></li+	></ul+      ><p class="caption empty"+      ></p+      ></div+    ><div id="content"+    ><div id="module-header"+      ><table class="info"+	><tr+	  ><th+	    >Safe Haskell</th+	    ><td+	    >Safe</td+	    ></tr+	  ></table+	><p class="caption"+	>DuplicateRecordFields</p+	></div+      ><div id="interface"+      ><h1+	>Documentation</h1+	><div class="top"+	><p class="src"+	  ><span class="keyword"+	    >data</span+	    > <a id="t:RawReplay" class="def"+	    >RawReplay</a+	    > <a href="#" class="selflink"+	    >#</a+	    ></p+	  ><div class="subs constructors"+	  ><p class="caption"+	    >Constructors</p+	    ><table+	    ><tr+	      ><td class="src"+		><a id="v:RawReplay" class="def"+		  >RawReplay</a+		  ></td+		><td class="doc empty"+		></td+		></tr+	      ><tr+	      ><td colspan="2"+		><div class="subs fields"+		  ><p class="caption"+		    >Fields</p+		    ><ul+		    ><li+		      ><dfn class="src"+			><a id="v:headerSize" class="def"+			  >headerSize</a+			  > :: Int</dfn+			><div class="doc"+			><p+			  >The byte size of the first section.</p+			  ></div+			></li+		      ><li+		      ><dfn class="src"+			><a id="v:headerCRC" class="def"+			  >headerCRC</a+			  > :: Int</dfn+			><div class="doc"+			><p+			  >The CRC of the first section.</p+			  ></div+			></li+		      ><li+		      ><dfn class="src"+			><a id="v:header" class="def"+			  >header</a+			  > :: Int</dfn+			><div class="doc"+			><p+			  >The first section.</p+			  ></div+			></li+		      ><li+		      ><dfn class="src"+			><a id="v:contentSize" class="def"+			  >contentSize</a+			  > :: Int</dfn+			><div class="doc"+			><p+			  >The byte size of the second section.</p+			  ></div+			></li+		      ><li+		      ><dfn class="src"+			><a id="v:contentCRC" class="def"+			  >contentCRC</a+			  > :: Int</dfn+			><div class="doc"+			><p+			  >The CRC of the second section.</p+			  ></div+			></li+		      ><li+		      ><dfn class="src"+			><a id="v:content" class="def"+			  >content</a+			  > :: Int</dfn+			><div class="doc"+			><p+			  >The second section.</p+			  ></div+			></li+		      ><li+		      ><dfn class="src"+			><a id="v:footer" class="def"+			  >footer</a+			  > :: Int</dfn+			><div class="doc"+			><p+			  >Arbitrary data after the second section. In replays generated by+ Rocket League, this is always empty. However it is not technically+ invalid to put something here.</p+			  ></div+			></li+		      ></ul+		    ></div+		  ></td+		></tr+	      ></table+	    ></div+	  ></div+	></div+      ></div+    ><div id="footer"+    ></div+    ></body+  ></html+>
html-test/ref/Examples.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Examples.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Extensions.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Extensions.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/FunArgs.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_FunArgs.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/GADTRecords.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_GADTRecords.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Hash.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Hash.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/HiddenInstances.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_HiddenInstances.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/HiddenInstancesB.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_HiddenInstancesB.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Hyperlinks.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Hyperlinks.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/IgnoreExports.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_IgnoreExports.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/ImplicitParams.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_ImplicitParams.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Instances.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Instances.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head@@ -276,48 +276,6 @@ 		      ></span 		      > <a href="#" 		      >Foo</a-		      > ((-&gt;) a)</span-		    > <a href="#" class="selflink"-		    >#</a-		    ></td-		  ><td class="doc empty"-		  ></td-		  ></tr-		><tr-		><td colspan="2"-		  ><div id="section.i:ic:Foo:Foo:3" class="inst-details hide"-		    ><div class="subs methods"-		      ><p class="caption"-			>Methods</p-			><p class="src"-			><a href="#"-			  >foo</a-			  > :: (a -&gt; <a href="#"-			  >Int</a-			  >) -&gt; a -&gt; a -&gt; a <a href="#" class="selflink"-			  >#</a-			  ></p-			><p class="src"-			><a href="#"-			  >foo'</a-			  > :: (a -&gt; a -&gt; a) -&gt; <a href="#"-			  >Int</a-			  > -&gt; a -&gt; a -&gt; <a href="#"-			  >Int</a-			  > <a href="#" class="selflink"-			  >#</a-			  ></p-			></div-		      ></div-		    ></td-		  ></tr-		><tr-		><td class="src clearfix"-		  ><span class="inst-left"-		    ><span id="control.i:ic:Foo:Foo:4" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:4')"-		      ></span-		      > <a href="#"-		      >Foo</a 		      > (<a href="#" 		      >Either</a 		      > a)</span@@ -329,7 +287,7 @@ 		  ></tr 		><tr 		><td colspan="2"-		  ><div id="section.i:ic:Foo:Foo:4" class="inst-details hide"+		  ><div id="section.i:ic:Foo:Foo:3" class="inst-details hide" 		    ><div class="subs methods" 		      ><p class="caption" 			>Methods</p@@ -370,7 +328,7 @@ 		><tr 		><td class="src clearfix" 		  ><span class="inst-left"-		    ><span id="control.i:ic:Foo:Foo:5" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:5')"+		    ><span id="control.i:ic:Foo:Foo:4" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:4')" 		      ></span 		      > (<a href="#" 		      >Eq</a@@ -389,7 +347,7 @@ 		  ></tr 		><tr 		><td colspan="2"-		  ><div id="section.i:ic:Foo:Foo:5" class="inst-details hide"+		  ><div id="section.i:ic:Foo:Foo:4" class="inst-details hide" 		    ><div class="subs methods" 		      ><p class="caption" 			>Methods</p@@ -418,7 +376,7 @@ 		><tr 		><td class="src clearfix" 		  ><span class="inst-left"-		    ><span id="control.i:ic:Foo:Foo:6" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:6')"+		    ><span id="control.i:ic:Foo:Foo:5" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:5')" 		      ></span 		      > <a href="#" 		      >Foo</a@@ -433,7 +391,7 @@ 		  ></tr 		><tr 		><td colspan="2"-		  ><div id="section.i:ic:Foo:Foo:6" class="inst-details hide"+		  ><div id="section.i:ic:Foo:Foo:5" class="inst-details hide" 		    ><div class="subs methods" 		      ><p class="caption" 			>Methods</p@@ -474,7 +432,7 @@ 		><tr 		><td class="src clearfix" 		  ><span class="inst-left"-		    ><span id="control.i:ic:Foo:Foo:7" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:7')"+		    ><span id="control.i:ic:Foo:Foo:6" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:6')" 		      ></span 		      > <a href="#" 		      >Foo</a@@ -489,7 +447,7 @@ 		  ></tr 		><tr 		><td colspan="2"-		  ><div id="section.i:ic:Foo:Foo:7" class="inst-details hide"+		  ><div id="section.i:ic:Foo:Foo:6" class="inst-details hide" 		    ><div class="subs methods" 		      ><p class="caption" 			>Methods</p@@ -518,7 +476,7 @@ 		><tr 		><td class="src clearfix" 		  ><span class="inst-left"-		    ><span id="control.i:ic:Foo:Foo:8" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:8')"+		    ><span id="control.i:ic:Foo:Foo:7" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:7')" 		      ></span 		      > <a href="#" 		      >Foo</a@@ -533,7 +491,7 @@ 		  ></tr 		><tr 		><td colspan="2"-		  ><div id="section.i:ic:Foo:Foo:8" class="inst-details hide"+		  ><div id="section.i:ic:Foo:Foo:7" class="inst-details hide" 		    ><div class="subs methods" 		      ><p class="caption" 			>Methods</p@@ -571,6 +529,76 @@ 		      ></div 		    ></td 		  ></tr+		><tr+		><td class="src clearfix"+		  ><span class="inst-left"+		    ><span id="control.i:ic:Foo:Foo:8" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:8')"+		      ></span+		      > <a href="#"+		      >Foo</a+		      > ((-&gt;) <a href="#"+		      >LiftedRep</a+		      > <a href="#"+		      >LiftedRep</a+		      > a)</span+		    > <a href="#" class="selflink"+		    >#</a+		    ></td+		  ><td class="doc empty"+		  ></td+		  ></tr+		><tr+		><td colspan="2"+		  ><div id="section.i:ic:Foo:Foo:8" class="inst-details hide"+		    ><div class="subs methods"+		      ><p class="caption"+			>Methods</p+			><p class="src"+			><a href="#"+			  >foo</a+			  > :: (<a href="#"+			  >LiftedRep</a+			  > -&gt; <a href="#"+			  >LiftedRep</a+			  >) a <a href="#"+			  >Int</a+			  > -&gt; a -&gt; (<a href="#"+			  >LiftedRep</a+			  > -&gt; <a href="#"+			  >LiftedRep</a+			  >) a a <a href="#" class="selflink"+			  >#</a+			  ></p+			><p class="src"+			><a href="#"+			  >foo'</a+			  > :: (<a href="#"+			  >LiftedRep</a+			  > -&gt; <a href="#"+			  >LiftedRep</a+			  >) a ((<a href="#"+			  >LiftedRep</a+			  > -&gt; <a href="#"+			  >LiftedRep</a+			  >) a a) -&gt; <a href="#"+			  >Int</a+			  > -&gt; (<a href="#"+			  >LiftedRep</a+			  > -&gt; <a href="#"+			  >LiftedRep</a+			  >) a ((<a href="#"+			  >LiftedRep</a+			  > -&gt; <a href="#"+			  >LiftedRep</a+			  >) a <a href="#"+			  >Int</a+			  >) <a href="#" class="selflink"+			  >#</a+			  ></p+			></div+		      ></div+		    ></td+		  ></tr 		></table 	      ></div 	    ></div@@ -608,7 +636,11 @@ 	    ><p class="src" 	    ><a id="v:bar0" class="def" 	      >bar0</a-	      >, <a id="v:bar1" class="def"+	      > :: (f a, f a) -&gt; (f b, f c) <a href="#" class="selflink"+	      >#</a+	      ></p+	    ><p class="src"+	    ><a id="v:bar1" class="def" 	      >bar1</a 	      > :: (f a, f a) -&gt; (f b, f c) <a href="#" class="selflink" 	      >#</a
html-test/ref/Math.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Math.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Minimal.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Minimal.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head@@ -132,26 +132,6 @@ 	    > <a href="#" class="selflink" 	    >#</a 	    ></p-	  ><div class="subs minimal"-	  ><p class="caption"-	    >Minimal complete definition</p-	    ><p class="src"-	    ><a href="#"-	      >a</a-	      >, <a href="#"-	      >b</a-	      >, <a href="#"-	      >c</a-	      > | <a href="#"-	      >d</a-	      > | <a href="#"-	      >e</a-	      >, (<a href="#"-	      >f</a-	      > | <a href="#"-	      >g</a-	      >)</p-	    ></div 	  ><div class="subs methods" 	  ><p class="caption" 	    >Methods</p
html-test/ref/ModuleWithWarning.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_ModuleWithWarning.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/NamedDoc.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_NamedDoc.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Nesting.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Nesting.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/NoLayout.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_NoLayout.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/NonGreedy.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_NonGreedy.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Operators.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Operators.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head@@ -97,7 +97,7 @@ 	    >(:+)</a 	    > :: <span class="keyword" 	    >forall</span-	    > t. t -&gt; t -&gt; [t]</li+	    > a. a -&gt; a -&gt; [a]</li 	  ><li class="src short" 	  ><span class="keyword" 	    >data</span@@ -271,7 +271,7 @@ 	    >(:+)</a 	    > :: <span class="keyword" 	    >forall</span-	    > t. t -&gt; t -&gt; [t] <span class="fixity"+	    > a. a -&gt; a -&gt; [a] <span class="fixity" 	    >infixr 3</span 	    ><span class="rightedge" 	    ></span@@ -432,12 +432,18 @@ 	    ><p class="src" 	    ><a id="v:-62--62--60-" class="def" 	      >(&gt;&gt;&lt;)</a-	      >, <a id="v:-60--60--62-" class="def"+	      > :: a -&gt; b -&gt; () <span class="fixity"+	      >infixr 4</span+	      ><span class="rightedge"+	      ></span+	      > <a href="#" class="selflink"+	      >#</a+	      ></p+	    ><p class="src"+	    ><a id="v:-60--60--62-" class="def" 	      >(&lt;&lt;&gt;)</a 	      > :: a -&gt; b -&gt; () <span class="fixity"-	      >infixl 5 &lt;&lt;&gt;</span-	      ><span class="fixity"-	      >infixr 4 &gt;&gt;&lt;</span+	      >infixl 5</span 	      ><span class="rightedge" 	      ></span 	      > <a href="#" class="selflink"@@ -446,16 +452,50 @@ 	    ><p class="src" 	    ><a id="v:-42--42--62-" class="def" 	      >(**&gt;)</a-	      >, <a id="v:-42--42--60-" class="def"+	      > :: a -&gt; a -&gt; () <span class="fixity"+	      >infixr 8</span+	      ><span class="rightedge"+	      ></span+	      > <a href="#" class="selflink"+	      >#</a+	      ></p+	    ><div class="doc"+	    ><p+	      >Multiple fixities</p+	      ></div+	    ><p class="src"+	    ><a id="v:-42--42--60-" class="def" 	      >(**&lt;)</a-	      >, <a id="v:-62--42--42-" class="def"+	      > :: a -&gt; a -&gt; () <span class="fixity"+	      >infixl 8</span+	      ><span class="rightedge"+	      ></span+	      > <a href="#" class="selflink"+	      >#</a+	      ></p+	    ><div class="doc"+	    ><p+	      >Multiple fixities</p+	      ></div+	    ><p class="src"+	    ><a id="v:-62--42--42-" class="def" 	      >(&gt;**)</a-	      >, <a id="v:-60--42--42-" class="def"+	      > :: a -&gt; a -&gt; () <span class="fixity"+	      >infixr 8</span+	      ><span class="rightedge"+	      ></span+	      > <a href="#" class="selflink"+	      >#</a+	      ></p+	    ><div class="doc"+	    ><p+	      >Multiple fixities</p+	      ></div+	    ><p class="src"+	    ><a id="v:-60--42--42-" class="def" 	      >(&lt;**)</a 	      > :: a -&gt; a -&gt; () <span class="fixity"-	      >infixr 8 **&gt;, &gt;**</span-	      ><span class="fixity"-	      >infixl 8 **&lt;, &lt;**</span+	      >infixl 8</span 	      ><span class="rightedge" 	      ></span 	      > <a href="#" class="selflink"
html-test/ref/OrphanInstances.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_OrphanInstances.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/OrphanInstancesClass.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_OrphanInstancesClass.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/OrphanInstancesType.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_OrphanInstancesType.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
+ html-test/ref/PR643.html view
@@ -0,0 +1,80 @@+<html xmlns="http://www.w3.org/1999/xhtml"+><head+  ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"+     /><title+    >PR643</title+    ><link href="#" rel="stylesheet" type="text/css" title="Ocean"+     /><script src="haddock-util.js" type="text/javascript"+    ></script+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ></script+    ><script type="text/javascript"+    >//+window.onload = function () {pageLoad();};+//+</script+    ></head+  ><body+  ><div id="package-header"+    ><ul class="links" id="page-menu"+      ><li+	><a href="#"+	  >Contents</a+	  ></li+	><li+	><a href="#"+	  >Index</a+	  ></li+	></ul+      ><p class="caption empty"+      ></p+      ></div+    ><div id="content"+    ><div id="module-header"+      ><table class="info"+	><tr+	  ><th+	    >Safe Haskell</th+	    ><td+	    >Safe</td+	    ></tr+	  ></table+	><p class="caption"+	>PR643</p+	></div+      ><div id="synopsis"+      ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')"+	>Synopsis</p+	><ul id="section.syn" class="hide" onclick="toggleSection('syn')"+	><li class="src short"+	  ><a href="#"+	    >test</a+	    > :: ()</li+	  ></ul+	></div+      ><div id="interface"+      ><h1+	>Documentation</h1+	><div class="top"+	><p class="src"+	  ><a id="v:test" class="def"+	    >test</a+	    > :: () <span class="fixity"+	    >infixr 5</span+	    ><span class="rightedge"+	    ></span+	    > <a href="#" class="selflink"+	    >#</a+	    ></p+	  ><div class="doc"+	  ><p+	    >Some big documentation</p+	    ></div+	  ></div+	></div+      ></div+    ><div id="footer"+    ></div+    ></body+  ></html+>
html-test/ref/PatternSyns.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_PatternSyns.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head@@ -69,9 +69,9 @@ 	    >Foo</a 	    > :: <span class="keyword" 	    >forall</span-	    > t. t -&gt; <a href="#"+	    > x. x -&gt; <a href="#" 	    >FooType</a-	    > t</li+	    > x</li 	  ><li class="src short" 	  ><span class="keyword" 	    >pattern</span@@ -79,11 +79,11 @@ 	    >Bar</a 	    > :: <span class="keyword" 	    >forall</span-	    > t. t -&gt; <a href="#"+	    > x. x -&gt; <a href="#" 	    >FooType</a 	    > (<a href="#" 	    >FooType</a-	    > t)</li+	    > x)</li 	  ><li class="src short" 	  ><span class="keyword" 	    >pattern</span@@ -91,17 +91,19 @@ 	    >(:&lt;-&gt;)</a 	    > :: <span class="keyword" 	    >forall</span-	    > t t1. t -&gt; t1 -&gt; (<a href="#"+	    > x x1. x -&gt; x1 -&gt; (<a href="#" 	    >FooType</a-	    > t, <a href="#"+	    > x, <a href="#" 	    >FooType</a 	    > (<a href="#" 	    >FooType</a-	    > t1))</li+	    > x1))</li 	  ><li class="src short" 	  ><span class="keyword" 	    >data</span-	    > a <a href="#"+	    > (a :: <a href="#"+	    >*</a+	    >) <a href="#" 	    >&gt;&lt;</a 	    > b = <a href="#" 	    >Empty</a@@ -113,9 +115,19 @@ 	    >E</a 	    > :: <span class="keyword" 	    >forall</span-	    > k t t1. <a href="#"+	    > k a (b :: k). <a href="#" 	    >(&gt;&lt;)</a-	    > k t t1</li+	    > k a b</li+	  ><li class="src short"+	  ><span class="keyword"+	    >pattern</span+	    > <a href="#"+	    >PatWithExplicitSig</a+	    > :: <a href="#"+	    >Eq</a+	    > somex =&gt; somex -&gt; <a href="#"+	    >FooType</a+	    > somex</li 	  ></ul 	></div       ><div id="interface"@@ -157,9 +169,9 @@ 	    >Foo</a 	    > :: <span class="keyword" 	    >forall</span-	    > t. t -&gt; <a href="#"+	    > x. x -&gt; <a href="#" 	    >FooType</a-	    > t <a href="#" class="selflink"+	    > x <a href="#" class="selflink" 	    >#</a 	    ></p 	  ><div class="doc"@@ -179,11 +191,11 @@ 	    >Bar</a 	    > :: <span class="keyword" 	    >forall</span-	    > t. t -&gt; <a href="#"+	    > x. x -&gt; <a href="#" 	    >FooType</a 	    > (<a href="#" 	    >FooType</a-	    > t) <a href="#" class="selflink"+	    > x) <a href="#" class="selflink" 	    >#</a 	    ></p 	  ><div class="doc"@@ -203,13 +215,13 @@ 	    >(:&lt;-&gt;)</a 	    > :: <span class="keyword" 	    >forall</span-	    > t t1. t -&gt; t1 -&gt; (<a href="#"+	    > x x1. x -&gt; x1 -&gt; (<a href="#" 	    >FooType</a-	    > t, <a href="#"+	    > x, <a href="#" 	    >FooType</a 	    > (<a href="#" 	    >FooType</a-	    > t1)) <a href="#" class="selflink"+	    > x1)) <a href="#" class="selflink" 	    >#</a 	    ></p 	  ><div class="doc"@@ -225,7 +237,9 @@ 	><p class="src" 	  ><span class="keyword" 	    >data</span-	    > a <a id="t:-62--60-" class="def"+	    > (a :: <a href="#"+	    >*</a+	    >) <a id="t:-62--60-" class="def" 	    >&gt;&lt;</a 	    > b <a href="#" class="selflink" 	    >#</a@@ -261,9 +275,9 @@ 	    >E</a 	    > :: <span class="keyword" 	    >forall</span-	    > k t t1. <a href="#"+	    > k a (b :: k). <a href="#" 	    >(&gt;&lt;)</a-	    > k t t1 <a href="#" class="selflink"+	    > k a b <a href="#" class="selflink" 	    >#</a 	    ></p 	  ><div class="doc"@@ -273,6 +287,25 @@ 		>Empty</a 		></code 	      ></p+	    ></div+	  ></div+	><div class="top"+	><p class="src"+	  ><span class="keyword"+	    >pattern</span+	    > <a id="v:PatWithExplicitSig" class="def"+	    >PatWithExplicitSig</a+	    > :: <a href="#"+	    >Eq</a+	    > somex =&gt; somex -&gt; <a href="#"+	    >FooType</a+	    > somex <a href="#" class="selflink"+	    >#</a+	    ></p+	  ><div class="doc"+	  ><p+	    >Earlier ghc versions didn't allow explicit signatures+ on pattern synonyms.</p 	    ></div 	  ></div 	></div
html-test/ref/PromotedTypes.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_PromotedTypes.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Properties.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Properties.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/PruneWithWarning.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_PruneWithWarning.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/QuasiExpr.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_QuasiExpr.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/QuasiQuote.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_QuasiQuote.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/SpuriousSuperclassConstraints.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_SpuriousSuperclassConstraints.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head@@ -56,7 +56,7 @@ 	    >http://www.haskell.org/pipermail/haskell-cafe/2012-September/103600.html</a 	    ></p 	  ><p-	  >And here is the corresponding theard on glasgow-haskell-users:</p+	  >And here is the corresponding thread on glasgow-haskell-users:</p 	  ><p 	  ><a href="#" 	    >http://www.haskell.org/pipermail/glasgow-haskell-users/2012-September/022914.html</a@@ -77,7 +77,11 @@ 	    >data</span 	    > <a id="t:SomeType" class="def" 	    >SomeType</a-	    > f a <a href="#" class="selflink"+	    > (f :: <a href="#"+	    >*</a+	    > -&gt; <a href="#"+	    >*</a+	    >) a <a href="#" class="selflink" 	    >#</a 	    ></p 	  ><div class="subs instances"@@ -173,6 +177,18 @@ 			  > f a -&gt; <a href="#" 			  >SomeType</a 			  > f b <a href="#" class="selflink"+			  >#</a+			  ></p+			><p class="src"+			><a href="#"+			  >liftA2</a+			  > :: (a -&gt; b -&gt; c) -&gt; <a href="#"+			  >SomeType</a+			  > f a -&gt; <a href="#"+			  >SomeType</a+			  > f b -&gt; <a href="#"+			  >SomeType</a+			  > f c <a href="#" class="selflink" 			  >#</a 			  ></p 			><p class="src"
html-test/ref/TH.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_TH.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/TH2.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_TH2.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head@@ -49,7 +49,7 @@ 	><p class="src" 	  ><a id="v:f" class="def" 	    >f</a-	    > :: t -&gt; t <a href="#" class="selflink"+	    > :: p -&gt; p <a href="#" class="selflink" 	    >#</a 	    ></p 	  ></div
html-test/ref/Test.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Test.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Threaded.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Threaded.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Threaded_TH.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Threaded_TH.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head@@ -36,7 +36,7 @@ 	  ><th 	    >Safe Haskell</th 	    ><td-	    >None</td+	    >Safe</td 	    ></tr 	  ></table 	><p class="caption"
html-test/ref/Ticket112.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Ticket112.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Ticket61.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Ticket61.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Ticket75.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Ticket75.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/TitledPicture.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_TitledPicture.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/TypeFamilies.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_TypeFamilies.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head@@ -159,9 +159,9 @@ 	  ><li class="src short" 	  ><span class="keyword" 	    >class</span-	    > a <a href="#"+	    > (a :: k) <a href="#" 	    >&gt;&lt;</a-	    > b</li+	    > (b :: k)</li 	  ></ul 	></div       ><div id="interface"@@ -1779,9 +1779,9 @@ 	><p class="src" 	  ><span class="keyword" 	    >class</span-	    > a <a id="t:-62--60-" class="def"+	    > (a :: k) <a id="t:-62--60-" class="def" 	    >&gt;&lt;</a-	    > b <a href="#" class="selflink"+	    > (b :: k) <a href="#" class="selflink" 	    >#</a 	    ></p 	  ><div class="subs instances"
html-test/ref/TypeFamilies2.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_TypeFamilies2.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/TypeOperators.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_TypeOperators.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Unicode.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Unicode.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/Visible.html view
@@ -6,11 +6,11 @@     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//-window.onload = function () {pageLoad();setSynopsis(&quot;mini_Visible.html&quot;);};+window.onload = function () {pageLoad();}; // </script     ></head
html-test/ref/mini_A.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_AdvanceTypes.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_B.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Bug1.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Bug2.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Bug3.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Bug4.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Bug6.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Bug7.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Bug8.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_BugDeprecated.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_BugExportHeadings.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Bugs.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_DeprecatedClass.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_DeprecatedData.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_DeprecatedFunction.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_DeprecatedFunction2.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_DeprecatedFunction3.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_DeprecatedModule.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_DeprecatedModule2.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_DeprecatedNewtype.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_DeprecatedReExport.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_DeprecatedRecord.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_DeprecatedTypeFamily.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_DeprecatedTypeSynonym.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Examples.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_FunArgs.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_GADTRecords.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Hash.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_HiddenInstances.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_HiddenInstancesB.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Hyperlinks.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_IgnoreExports.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Math.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_ModuleWithWarning.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_NamedDoc.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_NoLayout.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_NonGreedy.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Properties.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_PruneWithWarning.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_QuasiExpr.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_QuasiQuote.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_SpuriousSuperclassConstraints.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_TH.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_TH2.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Test.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Ticket112.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Ticket61.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Ticket75.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_TitledPicture.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_TypeFamilies.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_TypeOperators.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Unicode.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
html-test/ref/mini_Visible.html view
@@ -7,7 +7,7 @@     ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"      /><script src="haddock-util.js" type="text/javascript"     ></script-    ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"     ></script     ><script type="text/javascript"     >//<![CDATA[
+ html-test/src/Bug647.hs view
@@ -0,0 +1,6 @@+module Bug647 where++class Bug647 a where+	f :: a -- ^ doc for arg1+	  -> a -- ^ doc for arg2+	  -> a -- ^ doc for arg3
+ html-test/src/BundledPatterns.hs view
@@ -0,0 +1,110 @@+{-# LANGUAGE DataKinds, GADTs, KindSignatures, PatternSynonyms, TypeOperators,+             ViewPatterns #-}+module BundledPatterns (Vec(Nil,(:>)), RTree (LR,BR)) where++import GHC.TypeLits+import Prelude hiding (head, tail)+import Unsafe.Coerce++-- | Fixed size vectors.+--+-- * Lists with their length encoded in their type+-- * 'Vec'tor elements have an __ASCENDING__ subscript starting from 0 and+--   ending at @'length' - 1@.+data Vec :: Nat -> * -> * where+  Nil  :: Vec 0 a+  Cons :: a -> Vec n a -> Vec (n + 1) a++infixr 5 `Cons`++-- | Add an element to the head of a vector.+--+-- >>> 3:>4:>5:>Nil+-- <3,4,5>+-- >>> let x = 3:>4:>5:>Nil+-- >>> :t x+-- x :: Num a => Vec 3 a+--+-- Can be used as a pattern:+--+-- >>> let f (x :> y :> _) = x + y+-- >>> :t f+-- f :: Num a => Vec ((n + 1) + 1) a -> a+-- >>> f (3:>4:>5:>6:>7:>Nil)+-- 7+--+-- Also in conjunctions with (':<'):+--+-- >>> let g (a :> b :> (_ :< y :< x)) = a + b +  x + y+-- >>> :t g+-- g :: Num a => Vec ((((n + 1) + 1) + 1) + 1) a -> a+-- >>> g (1:>2:>3:>4:>5:>Nil)+-- 12+pattern (:>) :: a -> Vec n a -> Vec (n + 1) a+pattern (:>) x xs <- ((\ys -> (head ys,tail ys)) -> (x,xs))+  where+    (:>) x xs = Cons x xs++infixr 5 :>++head :: Vec (n + 1) a -> a+head (x `Cons` _) = x++tail :: Vec (n + 1) a -> Vec n a+tail (_ `Cons` xs) = unsafeCoerce xs++-- | Perfect depth binary tree.+--+-- * Only has elements at the leaf of the tree+-- * A tree of depth /d/ has /2^d/ elements.+data RTree :: Nat -> * -> * where+  LR_ :: a -> RTree 0 a+  BR_ :: RTree d a -> RTree d a -> RTree (d+1) a++textract :: RTree 0 a -> a+textract (LR_ x) = x+{-# NOINLINE textract #-}++tsplit :: RTree (d+1) a -> (RTree d a,RTree d a)+tsplit (BR_ l r) = (unsafeCoerce l, unsafeCoerce r)+{-# NOINLINE tsplit #-}++-- | Leaf of a perfect depth tree+--+-- >>> LR 1+-- 1+-- >>> let x = LR 1+-- >>> :t x+-- x :: Num a => RTree 0 a+--+-- Can be used as a pattern:+--+-- >>> let f (LR a) (LR b) = a + b+-- >>> :t f+-- f :: Num a => RTree 0 a -> RTree 0 a -> a+-- >>> f (LR 1) (LR 2)+-- 3+pattern LR :: a -> RTree 0 a+pattern LR x <- (textract -> x)+  where+    LR x = LR_ x++-- | Branch of a perfect depth tree+--+-- >>> BR (LR 1) (LR 2)+-- <1,2>+-- >>> let x = BR (LR 1) (LR 2)+-- >>> :t x+-- x :: Num a => RTree 1 a+--+-- Case be used a pattern:+--+-- >>> let f (BR (LR a) (LR b)) = LR (a + b)+-- >>> :t f+-- f :: Num a => RTree 1 a -> RTree 0 a+-- >>> f (BR (LR 1) (LR 2))+-- 3+pattern BR :: RTree d a -> RTree d a -> RTree (d+1) a+pattern BR l r <- ((\t -> (tsplit t)) -> (l,r))+  where+    BR l r = BR_ l r
+ html-test/src/BundledPatterns2.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE DataKinds, GADTs, KindSignatures, PatternSynonyms, TypeOperators,+             ViewPatterns #-}+module BundledPatterns2 (Vec((:>), Empty), RTree(..)) where++import GHC.TypeLits++import BundledPatterns++pattern Empty :: Vec 0 a+pattern Empty <- Nil
+ html-test/src/DuplicateRecordFields.hs view
@@ -0,0 +1,25 @@+{-# LANGUAGE DuplicateRecordFields #-}+module DuplicateRecordFields (RawReplay(..)) where++import Prelude hiding (Int)++data Int = Int++data RawReplay = RawReplay+    { headerSize :: Int+    -- ^ The byte size of the first section.+    , headerCRC :: Int+    -- ^ The CRC of the first section.+    , header :: Int+    -- ^ The first section.+    , contentSize :: Int+    -- ^ The byte size of the second section.+    , contentCRC :: Int+    -- ^ The CRC of the second section.+    , content :: Int+    -- ^ The second section.+    , footer :: Int+    -- ^ Arbitrary data after the second section. In replays generated by+    -- Rocket League, this is always empty. However it is not technically+    -- invalid to put something here.+    }
+ html-test/src/PR643.hs view
@@ -0,0 +1,3 @@+module PR643 (test) where++import PR643_1
+ html-test/src/PR643_1.hs view
@@ -0,0 +1,7 @@+module PR643_1 where++infixr 5 `test`++-- | Some big documentation+test :: ()+test = ()
html-test/src/PatternSyns.hs view
@@ -20,3 +20,8 @@  -- | Pattern for 'Empty' pattern E = Empty++-- | Earlier ghc versions didn't allow explicit signatures+-- on pattern synonyms.+pattern PatWithExplicitSig :: Eq somex => somex -> FooType somex+pattern PatWithExplicitSig x = FooCtor x
html-test/src/SpuriousSuperclassConstraints.hs view
@@ -7,7 +7,7 @@ -- --   <http://www.haskell.org/pipermail/haskell-cafe/2012-September/103600.html> ----- And here is the corresponding theard on glasgow-haskell-users:+-- And here is the corresponding thread on glasgow-haskell-users: -- --   <http://www.haskell.org/pipermail/glasgow-haskell-users/2012-September/022914.html> --
latex-test/Main.hs view
@@ -1,10 +1,12 @@ {-# LANGUAGE CPP #-}  +import Data.Function import System.Environment import System.FilePath  import Test.Haddock+import Test.Haddock.Utils   checkConfig :: CheckConfig String@@ -12,7 +14,7 @@     { ccfgRead = Just     , ccfgClean = \_ -> id     , ccfgDump = id-    , ccfgEqual = (==)+    , ccfgEqual = (==) `on` crlfToLf     }