m,      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~&(c) Simon Marlow 2003BSD-likehaddock@projects.haskell.org experimentalportableSafes(c) Simon Marlow 2003-2006, David Waern 2006-2009, Mark Lentczner 2010BSD-likehaddock@projects.haskell.org experimentalportableNoneSafeOT(Perform a query on each level of a tree.cThis is stolen directly from SYB package and copied here to not introduce additional dependencies.3Perform a query with state on each level of a tree.This is the same as < but allows for stateful computations. In SYB it is called everythingWithContext& but I find this name somewhat nicer.-Apply transformation on each level of a tree. Just like ", this is stolen from SYB package.Create generic transformation.)Another function stolen from SYB package.:Combine two queries into one using alternative combinator.None3Mapping from modules to cross-package source paths.This mapping is actually a pair of maps instead of just one map. The reason for this is because when hyperlinking modules in import lists we have no ; available. On the other hand, we can't just use map with r as indices because certain modules may have common name but originate in different packages. Hence, we use both rich and poor versions, where the poor is just projection of rich, one cached in pair for better performance.>Path for making cross-package hyperlinks in generated sources.Used in V to determine whether module originates in current package or in an external package.+  +      None !"DORT VA map containing association between source locations and "details" of this location.For the time being, it is just a list of pairs. However, looking up things in such structure has linear complexity. We cannot use any hashmap-like stuff because source locations are not ordered. In the future, this should be replaced with interval tree data structure. <Add more detailed information to token stream using GHC API. ?Obtain details map for variables ("normally" used identifiers).Obtain details map for types.+Obtain details map for identifier bindings.That includes both identifiers bound by pattern matching or declared using ordinary assignment (in top-level declarations, let-expressions and where clauses)..Obtain details map for top-level declarations.+Obtain details map for import declarations.WThis map also includes type and variable details for items in export and import lists.8Check whether token stream span matches GHC source span.Currently, it is implemented as checking whether "our" span is contained in GHC span. The reason for that is because GHC span are generally wider and may spread across couple tokens. For example, (>>=) consists of three tokens: (, >>=, )&, but GHC source span associated with >>= variable contains ( and )(. Similarly, qualified identifiers like  Foo.Bar.quux are tokenized as Foo, ., Bar, ., quux& but GHC source span associated with quux contains all five elements.         NoneATurn source code string into a stream of more descriptive tokens.xResult should retain original file layout (including comments, whitespace, etc.), i.e. the following "law" should hold:  concat . map  .  = id2Split raw source string to more meaningful chunks.This is the initial stage of tokenization process. Each chunk is either a comment (including comment delimiters), a whitespace string, preprocessor macro (and all its content until the end of a line) or valid Haskell lexeme.6Split input to "first line" string and the rest of it.)Ideally, this should be done simply with  (== '\n'). However, Haskell also allows line-unbreaking (or whatever it is called) so things are not as simple and this function deals with that.XSplit input to whitespace string, (optional) preprocessor directive and the rest of it.Again, using something like  B would be nice to chunk input to whitespace. The problem is with # symbol - if it is placed at the very beginning of a line, it should be recognized as preprocessor macro. In any other case, it is ordinary Haskell symbol and can be used to declare operators. Hence, while dealing with whitespace we also check whether there happens to be #v symbol just after a newline character - if that is the case, we begin treating the whole line as preprocessor macro.CSplit input to comment content (including delimiters) and the rest.#Again, some more logic than simple 8 is required because of Haskell comment nesting policy.6Assign source location for each chunk in given stream.@Turn unrecognised chunk stream to more descriptive token stream.3Classify given string as appropriate Haskell token.JThis method is based on Haskell 98 Report lexical structure description: 1https://www.haskell.org/onlinereport/lexemes.htmloHowever, this is probably far from being perfect and most probably does not handle correctly all corner cases.  !"#$  !"#$(c) David Waern 2006-2009BSD-likehaddock@projects.haskell.org experimentalportableNone$9;%%Was this signature given by the user?&A parent and its children'pA mapping from the parent (main-binder) to its children and from each child to its grand-children, recursively.(A mapping from child to parent)-The parents of a subordinate in a declaration* A variant of +D where the return value from the first computation is not required.#,-./012345678%9:;<=>&?'()@*ABCDEFGH ,-./012345678%9:;<=>&?'()@*ABCDE",-./012345678%9:;<=>&?'()@*ABCDEFGH F(c) Mateusz Kowalczyk 2013, Simon Hengel 2013BSD-likehaddock@projects.haskell.org experimentalportableNone/9;[IJKIJKIJK Safe LMNOPQRSTUVWXMSTUVWX LMNOPQRSTUVWX (c) Simon Marlow 2003BSD-likehaddock@projects.haskell.org experimentalportableSafeYZ[YZ[YZ[ |(c) Simon Marlow 2003-2006, David Waern 2006-2009, Mateusz Kowalczyk 2013BSD-likehaddock@projects.haskellorg experimentalportableNone !"/0234DRC Haddock's own exception type.\Module\ contains the current module. This way we can distinguish imported and local identifiers.]'Option controlling how to qualify names^Never qualify any names._Qualify all names fully.`!Qualify all imported names fully.aJLike local, but strip module prefix from modules in the same hierarchy.bUses aliases of module names as suggested by module import renamings. However, we are unfortunately not able to maintain the original qualifications. Image a re-export of a whole module, how could the re-exported identifiers be qualified?#7Source-level options for controlling the documentation.$*This module should not appear in the docs.&Pretend everything is exported.'CNot the best place to get docs for things exported by this module.(*Render enabled extensions for this module.cAn instance origin information.jThis is used primarily in HTML backend to generate unique instance identifiers (for expandable sections).N}The head of an instance. Consists of a class name, a list of kind parameters, a list of type parameters and an instance typeOCAn instance head that may have documentation and a source location.dAlmost the same as e except for type binders.In order to perform type specialization for class instances, we need to substitute class variables to appropriate type. However, type variables in associated type are specified using  LHsTyVarBndrs instead of fH. This makes type substitution impossible and to overcome this issue, d type is introduced.gThe three types of instanceshBody (right-hand side)iData constructorsPExtends j" with cross-reference information.QFThis thing is part of the (existing or resulting) documentation. The : is the preferred place in the documentation to refer to.R^This thing is not part of the (existing or resulting) documentation, as far as Haddock knows.SFType of environment used to cross-reference identifiers in the syntax.UArguments and result are indexed by Int, zero-based from the left, because that's the easiest to use when recursing over types.[An exported declaration.\gAn exported entity for which we have no documentation (perhaps because it resides in another package).]A section heading.^Some documentation._$A cross-reference to another module.`A declaration.acMaybe a doc comment, and possibly docs for arguments (if this decl is a function or type-synonym).b/Subordinate names, possibly with documentation.cEInstances relevant to this declaration, possibly with documentation.dCFixity decls relevant to this declaration (including subordinates).egWhether the ExportItem is from a TH splice or not, for generating the appropriate type of Source link.gSubordinate names.hSection level (1, 2, 3, ...).iSection id (for hyperlinks).jSection heading text.kA subset of the fields of w' that we store in the interface files.m)The module represented by this interface.n%Textual information about the module.oTDocumentation of declarations originating from the module (including subordinates).q"All names exported by this module.r|All "visible" names exported by the module. A visible name is a name that will show up in the documentation of the module.s=Haddock options for this module (prune, ignore-exports, etc).wwP holds all information used to render a single Haddock page. It represents the  interface of a module. The core business of Haddock lies in creating this structure. Note that the record contains some fields that are only used to create the final record, and that are not used by the backends.y!The module behind this interface.z!Original file name of the module.{%Textual information about the module.|Documentation header.}6Documentation header with cross-reference information.~=Haddock options for this module (prune, ignore-exports, etc).Declarations originating from the module. Excludes declarations without names (instances and stand-alone documentation comments). Includes names of subordinate declarations mapped to their parent declarations.TDocumentation of declarations originating from the module (including subordinates).TDocumentation of declarations originating from the module (including subordinates).!All names exported by the module.|All "visible" names exported by the module. A visible name is a name that will show up in the documentation of the module. Aliases of module imports as in import A.B.C as C.!Instances exported by the module.Orphan instancesThe number of haddockable and haddocked items in the module, as a tuple. Haddockable items are the exports and the module itself.+Warnings for things defined in this module._Tokenized source code of module (avaliable if Haddock is invoked with source generation flag).k Convert an w to an klUseful for debuggingmno !pqrstuvwx\"]^_`ab#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLyMzc{|}N~OdghiPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~kl mno !pqrstuvwx\"]^_`ab#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLyMzc{|}N~OdghiPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~kGmno !pqrstuvwx\"]^_`ab#$%&'() *+,-./0123456789:;<=>?@ABCDEFGHIJKLyMzc{|}N~OdghiPQRSTUVWXYZ[\]^_`abcdefghijk lmnopqrstuvwxyz{|}~kl (c) The University of Glasgow 2001-2002, Simon Marlow 2003-2006, David Waern 2006-2009BSD-likehaddock@projects.haskell.org experimentalportableNone3Print a message to stdout, if it is not too verbose%Extract a module's short description.%Extract a module's short description.^Takes an arbitrary string and makes it a valid anchor ID. The mapping is identity preserving.The identity markup4program verbositymessage verbosity)4|(c) Simon Marlow 2003-2006, David Waern 2006-2009, Mateusz Kowalczyk 2013BSD-likehaddock@projects.haskell.org experimentalportableNoneLike  listToMaybe3 but returns the last element instead of the first.E     C     /     (c) Mark Lentczner 2010BSD-likehaddock@projects.haskell.org experimentalportableNone-Find a theme by name (case insensitive match)Standard theme used by default=Default themes that are part of Haddock; added with --default-themes The first theme in this list is considered the standard theme. Themes are "discovered" by scanning the html sub-dir of the libDir, and looking for directories with the extension .theme or .std-theme. The later is, obviously, the standard theme.%Build a theme from a single .css fileBuild a theme from a directory!Check if we have a built in themeFind a built in theme+Process input flags for CSS Theme arguments !"#$%&'()*+,-. *+ !"#$%&'()*+,-.s(c) Simon Marlow 2003-2006, David Waern 2006-2009, Mark Lentczner 2010BSD-likehaddock@projects.haskell.org experimentalportableNone /9Replace placeholder string elements with provided values.KUsed to generate URL for customized external paths, usually provided with --source-module, --source-entity$ and related command-line arguments.BspliceURL Nothing mmod mname Nothing "output/%{MODULE}.hs#%{NAME}""output/Foo.hs#foo"0Same as / but takes  instead of .1Concatenate a series of 2/ values vertically, with linebreaks in between.3 Join two 25 values together with a linebreak in between. Has 4 as left identity.5Promoted type quote (e.g. '[a, b],  '(a, b, c)).6Generate a named anchor7)generate an anchor identifier for a group8,Attributes for an area that can be collapsed94Attributes for an area that toggles a collapsed area:NAttributes for an area that toggles a collapsed area, and displays a control.!/0;<1=3>?@AB5CDEFGHIJKLMNO6P789:Q/0;<1=3>?@AB5CDEFGHIKLMNO6P789:!/0;<1=3>?@AB5CDEFGHIJKLMNO6P789:Q=838NoneRSTUVWXYZ[\]^_` RSTUVWXYZ[\]RSTUVWXYZ[\]^_`None!"a6Group consecutive tokens pointing to the same element.EWe want to render qualified identifiers as one entity. For example,  Bar.Baz.foo consists of 5 tokens (Bar, ., Baz, ., foo) but for better user experience when highlighting and clicking links, these tokens should be regarded as one identifier. Therefore, before rendering we must group consecutive elements pointing to the same jD (note that even dot token has it if it is part of qualified name).bcdefaghijklmnopqrstuvwxfbcdefaghijklmnopqrstuvwx(c) Neil Mitchell 2006-2008BSD-likehaddock@projects.haskell.org experimentalportableNoney%for constructors, and named-fields...z Just like {$ but uses '($+$)' instead of '($$)'.+|}~yz&|}~yzNone1Generate hyperlinked source for given interfaces.Note that list of interfaces should also contain interfaces normally hidden when generating documentation. Otherwise this could lead to dead links in produced source.5Generate hyperlinked source for particular interface.%Name of CSS file in output directory.:Name of highlight script in output and resource directory.Path to default CSS file.Output directoryResource directoryCustom CSS file path,Flag indicating whether to pretty-print HTMLPaths to sources%Interfaces for which we create source8  RSTUVWXYZ[\]F(c) Simon Marlow 2003-2006, David Waern 2006-2009BSD-likehaddock@projects.haskell.org experimentalportableNone!";9((c) Simon Marlow 2006, Isaac Dupree 2009BSD-likehaddock@projects.haskell.org experimentalportableNone"This function is how we read keys.7all fields in the header are optional and have the form spaces1[field name][spaces] ":"textg"n" ([spaces2][space][text]"n" | [spaces]"n")* where each [spaces2] should have [spaces1] as a prefix.Thus for the key  Description, VDescription : this is a rather long description The module comment starts here^the value will be "this is a .. description" and the rest will begin at "The module comment".A(c) Isaac Dupree 2009, Mateusz Kowalczyk 2013BSD-likehaddock@projects.haskell.org experimentalportableNoneTakes a  which (hopefully) contains all the definitions and a parsed comment and we attempt to make sense of where the identifiers in the comment point to. We're in effect trying to convert s to jNs, with some guesswork and fallbacks in case we can't locate the identifiers.=See the comments in the source for implementation commentary.>Wrap an identifier that's out of scope (i.e. wasn't found in GlobalReaderEnv during -) in an appropriate doc. Currently we simply monospace the identifier in most cases except when the identifier is qualified: if the identifier is qualified then we can still try to guess and generate anchors accross modules but the users shouldn't rely on this doing the right thing. See tickets 253 and H375 on the confusion this causes depending on which default we pick in .None!":OT Binding generation monad.Renaming monad. Haskell AST type representation.WThis type is used for renaming (more below), essentially the ambiguous (!) version of j. So, why is this  instead of ? Well, it was  before, but turned out that U sometimes also contains namespace information, differentiating visually same types.And  is used because it is visual part of  - it is not converted to P or alike to avoid new allocations. Additionally, since it is stored mostly in , fast comparison of  is also quite nice.?Instantiate all occurrences of given name with particular type.DInstantiate all occurrences of given names with corresponding types.+It is just a convenience function wrapping - that supports more that one specialization.3Instantiate given binders with corresponding types.0Again, it is just a convenience function around M. Note that length of type list should be the same as the number of binders.oMake all details of instance head (signatures, associated types) specialized to that particular instance type.>Make given type use tuple and list literals where appropriate.After applying \ function some terms may not use idiomatic list and tuple literals resulting in types like [] a or  (,,) a b c. This can be fixed using * function, that will turn such types into [a] and  (a, b, c).&Compute arity of given tuple operator.parseTupleArity "(,,)"Just 3parseTupleArity "(,,,,)"Just 5parseTupleArity "abc"NothingparseTupleArity "()"Nothing,Compute set of free variables of given type.%Make given type visually unambiguous.After applying W method, some free type variables may become visually ambiguous - for example, having a -> b and specializing a to (a -> b) we get  (a -> b) -> b where first occurrence of b> refers to different type variable than latter one. Applying Z function will fix that type to be visually unambiguous again (making it something like  (a -> c) -> b).?Generate fresh occurrence name, put it into context and return.*     '     (c) Isaac Dupree 2009,BSD-likehaddock@projects.haskell.org experimentalportableNone^normal situation. This is the safe one to use if you don't quite understand what's going on.sbeginning of a function definition, in which, to make it look less ugly, those rank-1 foralls are made implicit.Jbecause in class methods the context is added to the type (e.g. adding forall a. Num a => to (+) :: a -> a -> a) which is rather sensible, but we want to restore things to the source-syntax situation where the defining class gets to quantify all its functions for free! 3Turn type constructors into type class declarations!"#$ %&'()*+,-./012345!"#$ %&'()*+,-./012345!"#$ %&'()*+,-./012345|(c) Simon Marlow 2003-2006, David Waern 2006-2009, Mateusz Kowalczyk 2013BSD-likehaddock@projects.haskell.org experimentalportableNoneL[6Use a 7 to produce an wj. To do this, we need access to already processed modules in the topological sort. That's what's in the .8Create 9 by looping through the declarations. For each declaration, find its names, its subordinates, and its doc strings. Process doc strings into Ms.:FGet all subordinate declarations inside a declaration, and their docs.;1Extract function argument docs from inside types.<|All the sub declarations of a class (that we handle), ordered by source location, with documentation attached if it exists.=The top-level declarations of a module that we care about, ordered by source location, with documentation attached if it exists.>)Extract a map of fixity declarations only?ATake all declarations except pragmas, infix decls, rules from an @.AbTake a field of declarations from a data structure and create HsDecls using the given constructorBSort by source locationC7Filter out declarations that we don't handle in HaddockDCGo through all class declarations and filter their sub-declarationsE7Collect docs and attach them to the right declarations.FBuild the list of items that will become the documentation, from the export list. At this point, the list of ExportItems is in terms of original names.We create the export items even if the module is hidden, since they might be useful when creating the export items for other modules.GThis function is called for top-level bindings without type signatures. It gets the type signature from GHC and that means it's not going to have a meaningful H. So we pass down H+ for the declaration and use it instead - nLoc here.I(Lookup docs for a declaration from maps.JReturn all export items produced by an exported module. That is, we're interested in the exports produced by "module B" in such a scenario: 5module A (module B) where import B (...) hiding (...),There are three different cases to consider:1) B is hidden, in which case we return all its exports that are in scope in A. 2) B is visible, but not all its exports are in scope in A, in which case we only return those that are. 3) B is visible and all its exports are in scope, in which case we return a single _ item.KSometimes 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...).LKeep export items with docs.M5Find a stand-alone documentation comment by its name.#96NOPQRST8:;<=>?ABCDEFUGIJ Module A'The real name of B, the exported module"The flags used when typechecking A#The renaming environment used for AAll the exports of AAll the declarations in AAlready created interfacesInterfaces in other packages Locations of all TH splices Resulting export itemsVKWLXYZ[M6#96NOPQRST8:;<=>?ABCDEFUGIJVKWLXYZ[Mh(c) Simon Marlow 2006, David Waern 2006-2009, Isaac Dupree 2009BSD-likehaddock@projects.haskell.org experimentalportableNoneB\Simplified type for sorting types, ignoring qualification (not visible in Haddock output) and unifying special tycons with normal ones. For the benefit of the user (looks nice and predictable) and the tests (which prefer output to be deterministic).]{Like GHC's getInfo but doesn't cut things out depending on the interative context, which we don't set sufficiently anyway.^"A class or data type is hidden iff<it is defined in one of the modules that are being processed/and it is not exported by any non-hidden module_ZWe say that an instance is hidden iff its class or any (part) of its type(s) is hidden.\`abcdefgh]ijklmn^_oe\`abcdefgh]ijklmn^_os(c) Simon Marlow 2003-2006, David Waern 2006-2009, Mark Lentczner 2010BSD-likehaddock@projects.haskell.org experimentalportableNonepIndicator of how to render a P into 2q Render as-is.rRender using infix notation.sRender using prefix notation.t:Render a name depending on the selected qualification modepqrsuvwxyzt{|}~psrqvwxyz}~pqrsuvwxyzt{|}~A(c) Simon Marlow 2003-2006, David Waern 2006BSD-likehaddock@projects.haskell.org experimentalportableNoneNone F(c) Simon Marlow 2010, Mateusz Kowalczyk 2013BSD-likehaddock@projects.haskell.org experimentalportableNone!"OPrint a possibly commented instance. The instance header is printed inside an argBoxJ. The comment is printed to the right of the box in normal comment style.oPrint the LHS of a data/newtype declaration. Currently doesn't handle 'data instance' decls or kind signaturesIPrint an application of a DocName and two lists of HsTypes (kinds, types)5Print an application of a DocName and a list of Names%General printing of type applicationsy     v     4 s(c) Simon Marlow 2003-2006, David Waern 2006-2009, Mark Lentczner 2010BSD-likehaddock@projects.haskell.org experimentalportableNone5We use this intermediate type to transform the input My tree in an arbitrary way before rendering, such as grouping some elements. This is effectivelly a hack to prevent the Mg type from changing if it is possible to recover the layout information we won't need after the fact.Group things under bold  s together.Remove top-level  s turning them into a flat list. This lends itself much better to processing things in order user might look at them, such as in .8Generate the markup needed for collapse to happen. For  and 7 we do nothing more but extract/append the underlying M and convert it to 2. For (, we attach extra info to the generated 20 that allows us to expand/collapse the content. Goes through  to generate the 2# rather than skipping straight to C: this allows us to employ XHtml specific hacks to the tree first.Same as  but it doesn't insert the G element in links. This is used to generate the Contents box elements.ZCounter for header IDs which serves to assign unique identifiers within the comment scopeIt is not enough to have unique identifier within the scope of the comment: if two different comments have the same ID for headers, the collapse/expand behaviour will act on them both. This serves to make each header a little bit more unique. As we can't export things with the same names, this should work more or less fine: it is in fact the implicit assumption the collapse/expand mechanism makes for things like Instances  boxes.4Name of the thing this doc is for. See comments on  for details.See  !!Name of the thing this doc is for"!Name of the thing this doc is for# !" !"#!s(c) Simon Marlow 2003-2006, David Waern 2006-2009, Mark Lentczner 2010BSD-likehaddock@projects.haskell.org experimentalportableNone$Make an element that always has at least something (a non-breaking space). If it would have otherwise been empty, then give it the class ".empty".%-Sub table with source information (optional).&9Generate sub table for instance declarations, with source'xAdds a source and wiki link at the right hand side of the box. Name must be documented, otherwise we wouldn't get here.)()*+$,-./0123456789:;<%=>?@AB&&Class name, used for anchor generationCD*Instance unique id (for anchor generation)'Header content (instance name and type)E*Instance unique id (for anchor generation)Associated type contents+Method contents (pretty-printed signatures)F*Instance unique id (for anchor generation)Type or data family instanceG*Instance unique id (for anchor generation)HIJKL' ()+$,-./0123456789>?@AB&CDEFIJKL)()*+$,-./0123456789:;<%=>?@AB&CDEFGHIJKL'"s(c) Simon Marlow 2003-2006, David Waern 2006-2009, Mark Lentczner 2010BSD-likehaddock@projects.haskell.org experimentalportableNone!"GOTMPretty-print type variables.N%Print a type family and its variablesO/Print a newtype / data binder and its variablesPPrint an application of a P and two lists of HsTypes (kinds, types)QPrint an application of a P and a list of NamesR%General printing of type applicationsSoPrint the LHS of a data/newtype declaration. Currently doesn't handle 'data instance' decls or kind signaturesOTUVWXYZ[M\]^_`abcdefghiNOjPQRklmnopqrstuvwxIs instance orphanNormalyz{|}~ST\`cRwOTUVWXYZ[M\]^_`abcdefghiNOjPQRklmnopqrstuvwxyz{|}~S#(c) Simon Marlow 2003-2006, David Waern 2006-2009, Mark Lentczner 2010, Mateusz Kowalczyk 2013BSD-likehaddock@projects.haskell.org experimentalportableNone TitlePackageDestination directoryPrologue text, maybeThemesThe mathjax URL (--mathjax)The source URL (--source) The wiki URL (--wiki) !The contents URL (--use-contents) The index URL (--use-index) 0Whether to use unicode in output (--use-unicode) How to qualify names+Output pretty html (newlines and indenting) How to qualify namesOrphans sections$K(c) David Waern 2006-2009, Mateusz Kowalczyk 2013BSD-likehaddock@projects.haskell.org experimentalportableNoneOTRead a Haddock (.haddock$) interface file. Return either an  or an error message.\This function can be called in two ways. Within a GHC session it will update the use and update the session's name cache. Outside a GHC session a new empty name cache is used. The function is therefore generic in the monad being used. The exact monad is whichever monad the first argument, the getter and setter of the name cache, requires.+ "%|(c) Simon Marlow 2003-2006, David Waern 2006-2010, Mateusz Kowalczyk 2013BSD-likehaddock@projects.haskell.org experimentalportableNoneCreate wzs and a link environment by typechecking the list of modules using the GHC API and processing the resulting syntax trees.:Build a mapping which for each original name, points to the "best" place to link to in the documentation. For the definition of "best", we use "the module nearest the bottom of the dependency graph which exports this name", not including hidden modules. When there are multiple choices, we pick a random one.uThe interfaces are passed in in topologically sorted order, but we start by reversing the list so we can do a foldl.Verbosity of logging to stdout9A list of file or module names sorted by module topologyCommand-line flags'Interface files of package dependencies6Resulting list of interfaces and renaming environment&r(c) Simon Marlow 2003-2006, David Waern 2006-2010, Mateusz Kowalczyk 2014BSD-likehaddock@projects.haskell.org experimentalportableNoneOT[oEither returns normally or throws an ExitCode exception; all other exceptions are turned into exit exceptions.)Run Haddock with given list of arguments.8Haddock's own main function is defined in terms of this: main = getArgs >>= haddock1Create warnings about potential misuse of -optghcFRender the interfaces with whatever backend is specified in the flags.TFrom GHC 7.10, this function has a potential to crash with a nasty message such as expectJust getPackageDetails because package name and versions can no longer reliably be extracted in all cases: if the package is not installed yet then this info is no longer available. The --package-name and --package-version Haddock flags allow the user to specify this information and it is returned here if present: if it is not present, the error will occur. Nasty but that's how it is for now. Potential TODO.kStart a GHC session with the -haddock flag set. Also turn off compilation and linking. Then run the given  action.1Generate some warnings about potential misuse of --hyperlinked-source.uHaddock flags are checked as they may contain the package name or version provided by the user which we prioritise(c) David Waern 2010BSD-likehaddock@projects.haskellorg experimentalportableNoneCreate wf structures from a given list of Haddock command-line flags and file or module names (as accepted by m executable). Flags that control documentation generation or show help or version information are ignored.A list of command-line flagsFile or module namesResulting list of interfaces  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~wxyz{|}~klmnopqrstuZ[\]^_`abcdefghijTUSPQRONM 456789:;<=>?@ABCDEFGHIJKLVWXY"v)*+,-./0123#$%&'( !'()'(*'(+'(+'(,'(-'(.'(.'(/'(0'(1'(2'(3'(4'(5'(6'(7'(8'(9'(:'(;'(<'(='(>'(?'(@'(A'(B'(C'(D'(E'(F G G H I J K L M N O O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { { | } ~             $$$$$$$$%&&&&        !"##$%&'()*+,-./012345678967:6;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij k l m n o p q r s t u v w x y z { | } ~                               s                                                       '('('('('('('('('('('('('('('('('(                                                   66 6!"#$%&'()*+,-./0123456789:;<=>?@ABBCDEFGHIJKLMNOPQRSTURSVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Q     6  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~|''''''''     dmnopqjklg`   ! " # $ % & ' (R)* + , - . / 0 1 2!3!4!5!6!7!8!9!:!;!<!=!>!?!@!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X!Y!Z![""\"]""""""^"""_""`"a"""""b"c"d"e"f"g"h""i"j"k"""""""l"""m""n"o""p"q""r"s""t"u""""v""""w"""""""""x"""y"""z""""#{#|#}#~##########################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%&&&&&&&&&&&&&&&&)haddock-api-2.17.3-GKhk2jS7yNzIS78A80hBKxDocumentation.HaddockHaddock.Backends.HaddockDBHaddock.Backends.Xhtml.Types Haddock.Syb"Haddock.Backends.Hyperlinker.Types Haddock.Backends.Hyperlinker.Ast#Haddock.Backends.Hyperlinker.ParserHaddock.GhcUtilsHaddock.ParserPaths_haddock_apiHaddock.Version Haddock.Types Haddock.UtilsHaddock.OptionsHaddock.Backends.Xhtml.ThemesHaddock.Backends.Xhtml.Utils"Haddock.Backends.Hyperlinker.Utils%Haddock.Backends.Hyperlinker.RendererHaddock.Backends.HoogleHaddock.Backends.HyperlinkerHaddock.Interface.Rename#Haddock.Interface.ParseModuleHeaderHaddock.Interface.LexParseRnHaddock.Interface.SpecializeHaddock.ConvertHaddock.Interface.Create!Haddock.Interface.AttachInstancesHaddock.Backends.Xhtml.NamesHaddock.ModuleTree Haddock.DocHaddock.Backends.LaTeX Haddock.Backends.Xhtml.DocMarkupHaddock.Backends.Xhtml.LayoutHaddock.Backends.Xhtml.DeclHaddock.Backends.XhtmlHaddock.InterfaceFileHaddock.InterfaceHaddock,haddock-library-1.4.2-F7UTHpERtmTC4fYnmJsN6zDocumentation.Haddock.TypeshyperlinkLabel hyperlinkUrl Hyperlink exampleResultexampleExpressionExample DocHeader DocExamples DocPropertyDocANameDocMathDisplay DocMathInlineDocPic DocHyperlink DocCodeBlock DocDefListDocOrderedListDocUnorderedListDocBold DocMonospaced DocEmphasis DocWarning DocModuleDocIdentifierUnchecked DocIdentifier DocParagraph DocString DocAppendDocEmptyDocHHaddockExceptionAliasMap DocOptionOptHideOptPruneOptIgnoreExports OptNotHomeOptShowExtensionsHaddockModInfohmi_description hmi_copyright hmi_licensehmi_maintainer hmi_stabilityhmi_portability hmi_safety hmi_languagehmi_extensions DocMarkupMarkup markupEmpty markupStringmarkupParagraph markupAppendmarkupIdentifiermarkupIdentifierUnchecked markupModule markupWarningmarkupEmphasis markupBoldmarkupMonospacedmarkupUnorderedListmarkupOrderedList markupDefListmarkupCodeBlockmarkupHyperlink markupAName markupPicmarkupMathInlinemarkupMathDisplaymarkupProperty markupExample markupHeaderDocInstHead DocInstanceDocName Documented UndocumentedLinkEnv DocForDecl FnArgsDoc DocumentationdocumentationDocdocumentationWarning ExportItem ExportDecl ExportNoDecl ExportGroup ExportDoc ExportModule expItemDecl expItemMbDocexpItemSubDocsexpItemInstancesexpItemFixitiesexpItemSpliced expItemName expItemSubsexpItemSectionLevelexpItemSectionIdexpItemSectionTextInstalledInterfaceinstModinstInfo instDocMap instArgMap instExportsinstVisibleExports instOptions instSubMap instFixMap WarningMap InterfaceifaceModifaceOrigFilename ifaceInfoifaceDoc ifaceRnDoc ifaceOptions ifaceDeclMap ifaceDocMap ifaceArgMap ifaceRnDocMap ifaceRnArgMap ifaceSubMap ifaceFixMapifaceExportItemsifaceRnExportItems ifaceExportsifaceVisibleExportsifaceModuleAliasesifaceInstancesifaceFamInstancesifaceOrphanInstancesifaceRnOrphanInstancesifaceHaddockCoverageifaceWarningMapifaceTokenizedSrcArgMapDocMapmarkupFlagFlag_BuiltInThemesFlag_CSSFlag_ReadInterfaceFlag_DumpInterface Flag_Heading Flag_Html Flag_HoogleFlag_LibFlag_OutputDir Flag_PrologueFlag_SourceBaseURLFlag_SourceModuleURLFlag_SourceEntityURLFlag_SourceLEntityURLFlag_WikiBaseURLFlag_WikiModuleURLFlag_WikiEntityURL Flag_LaTeXFlag_LaTeXStyleFlag_HyperlinkedSourceFlag_SourceCss Flag_Mathjax Flag_HelpFlag_Verbosity Flag_Version Flag_CompatibleInterfaceVersionsFlag_InterfaceVersionFlag_UseContentsFlag_GenContents Flag_UseIndex Flag_GenIndexFlag_IgnoreAllExportsFlag_HideModuleFlag_ShowExtensions Flag_OptGhcFlag_GhcLibDirFlag_GhcVersionFlag_PrintGhcPathFlag_PrintGhcLibDirFlag_NoWarningsFlag_UseUnicodeFlag_NoTmpCompDirFlag_QualificationFlag_PrettyHtmlFlag_NoPrintMissingDocsFlag_PackageNameFlag_PackageVersionNameCacheAccessor InterfaceFile ifLinkEnvifInstalledIfacesnameCacheFromGhcfreshNameCachereadInterfaceFileprocessModuleshaddockhaddockWithGhcwithGhc getGhcDirscreateInterfaces ppDocBookUnicodeSplice LinksInfoWikiURLs SourceURLs everythingeverythingWithState everywheremkTcombineSrcMapghcModule ModuleNameSrcPath SrcExternalSrcLocal TokenDetailsRtkVarRtkTypeRtkBindRtkDecl RtkModule RichTokenrtkToken rtkDetails TokenType TkIdentifier TkKeywordTkStringTkCharTkNumber TkOperatorTkGlyph TkSpecialTkSpace TkCommentTkCppTkPragma TkUnknownSpanspStartspEndPositionposRowposColTokentkTypetkValuetkSpanrtkNamemkSrcMap DetailsMapenrich variablestypesbindsdeclsimportsmatches lookupBySpan enrichTokenparsechunk spanToNewlinebaseGHC.ListbreakspanSpaceOrCppspan GHC.UnicodeisSpace chunkCommenttagtokenizeclassifykeywordsglyphsspecialsymbols isIdentifier isUserLSigfamilyfamilies parentMapparents gbracket_ ExceptiongbracketParentchildren moduleString isNameSymisVarSymisConSymgetMainDeclBinder getInstLocfilterLSigNamesfilterSigNames ifTrueJustsigName sigNameNoLocisClassDisValDdeclATsprettyunLreL familyConDeclmodifySessionDynFlags minimalDef setObjectDirsetHiDir setStubDir setOutputDir$fParentTyClDecl$fParentConDecl$fNamedThingTyClDecl parseParas parseString parseIdentcatchIOversionbindirlibdirdatadir libexecdir sysconfdir getBinDir getLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName projectName projectUrlprojectVersion AliasedQual QualOption OptNoQual OptFullQual OptLocalQualOptRelativeQualOptAliasedQual InstOriginPseudoFamilyDeclHsDecls FamilyDeclHsTypesHsTypeInstTypeTypeInstDataInstNametoInstalledIface$fOutputableDocName ErrMsgGhc WriterGhc runWriterGhcErrMsgMWriter runWriterErrMsg QualificationNoQualFullQual LocalQual RelativeQualMDocLDoc OriginClass OriginData OriginFamily ihdClsNameihdKindsihdTypes ihdInstTypepfdInfopfdLName pfdTyVars pfdKindSig ClassInstclsiCtx clsiTyVarsclsiSigs clsiAssocTysSetNamesetNameDocPathsFixMapInstMapDeclMapSubMap InstIfaceMapIfaceMap noDocForDeclmkPseudoFamilyDeclexampleToStringemptyHaddockModInfomakeContentsQualmakeModuleQualtellthrowEliftGhcToErrMsgGhc liftErrMsg$fMonadErrMsgGhc$fApplicativeErrMsgGhc$fFunctorErrMsgGhc$fExceptionHaddockException$fShowHaddockException$fMonadErrMsgM$fApplicativeErrMsgM$fFunctorErrMsgM$fNFDataExample$fNFDataPicture$fNFDataHyperlink$fNFDataHeader$fNFDataModuleName$fNFDataOccName $fNFDataName $fNFDataDocH$fNamedThingInstOrigin$fOutputableInstType$fSetNameDocName $fSetNameName$fOutputableBndrDocName$fNamedThingDocName BasicTypesFixityHsDoc HsDocString LHsDocStringoverDocMeta_versionMetaDoc_meta_docVersionPicture pictureUri pictureTitleHeader headerLevel headerTitleout toDescriptiontoInstalledDescription makeAnchorIdidMarkupparseVerbositymkMetamkEmptySigWcTypeaddClassContextlHsQTyVarsToTypes restrictTorestrictDataDefn restrictCons restrictDecls restrictATs emptyHsQTvsbaseNamemoduleHtmlFilemoduleHtmlFile'contentsHtmlFile indexHtmlFilemoduleIndexFrameName mainFrameNamesynopsisFrameNamesubIndexHtmlFile moduleUrl moduleNameUrlmoduleNameUrl' nameAnchorIdjsFilegetProgramNamebyedieMsgnoDieMsgmapSnd mapMaybeM escapeStr escapeURICharescapeURIString isUnreserved isAlphaChar isDigitCharisAlphaNumCharhtml_xrefs_refhtml_xrefs_ref' html_xrefs html_xrefs'replacespanWith markupPair getProcessID System.ExitdieControl.Monad.IO.ClassMonadIOliftIOoptLastoptionsgetUsageparseHaddockOptsoptPackageVersionoptPackageNameoptTitle outputDiroptContentsUrl optIndexUrl optCssFileoptSourceCssFile sourceUrlswikiUrlsoptDumpInterfaceFile optLaTeXStyle optMathjax qualification verbosityghcFlags readIfaceArgs findTheme standardTheme defaultThemessingleFileThemedirectoryThemedoesBuiltInExist builtInTheme getThemesPossibleThemes PossibleThemeThemesTheme themeName themeHref themeFiles errMessageretRightgetDirectoryItems isCssFilePathcssFiles styleSheetsequenceEither liftEither concatEither spliceURL spliceURL'vcatxhtml-3000.2.1Text.XHtml.InternalsHtml<=>noHtml promoQuote namedAnchorgroupIdcollapseSectioncollapseTogglecollapseControlrenderToStringhsep<+>keywordequalscommacharquoteparensbrackets pabracketsbraces punctuate parenList ubxParenList ubxparensdcolonarrowdarrow forallSymboldot linkedAnchorpick hypSrcDirhypSrcModuleFilehypSrcModuleFile'hypSrcModuleUrlhypSrcModuleUrl' hypSrcNameUrl hypSrcLineUrlhypSrcModuleNameUrlhypSrcModuleLineUrlhypSrcModuleUrlFormathypSrcModuleNameUrlFormathypSrcModuleLineUrlFormat moduleFormat nameFormat lineFormat groupTokens TokenGroup GrpNormalGrpRich StyleClassrenderbodyheader tokenGroup richToken tokenSpanrichTokenStyle tokenStyle multiclassexternalAnchorinternalAnchorexternalAnchorIdentinternalAnchorIdent hyperlinkinternalHyperlinkexternalNameHyperlinkexternalModHyperlink renderSpace lineAnchor lookupConvcat' OutputableTagsTagTagLTagPTagPre TagInlineStrprefixppHoogleppModule dropHsDocTy outHsType dropCommentoutWithoperator commaSeparateppExport ppSigWithDocppSigpp_sigppClass ppInstance ppSynonymppDatappCtorppFixityppDocumentationdocmdocdocWithboxstr markupTagshowTags showBlockasInline showInlineshowPre unwordsWrapescapeppHyperlinkedSourceppHyperlinkedModuleSource srcCssFilehighlightScriptdefaultCssFileRnMunRnrenameInterfacereturnRnthenRn getLookupRnoutRnlookupRnrunRnFMrenamerenameLrenameExportItemsrenameDocForDeclrenameDocumentationrenameLDocHsSyn renameDocrenameFnArgsDoc renameLTyperenameLSigTyperenameLSigWcType renameLKindrenameMaybeLKindrenameFamilyResultSigrenameInjectivityAnnrenameMaybeInjectivityAnn renameTyperenameLHsQTyVarsrenameLTyVarBndrrenameLContextrenameWildCardInforenameInstHead renameLDecl renameDecl renameLThing renameTyClDrenameFamilyDeclrenamePseudoFamilyDeclrenameFamilyInforenameDataDefn renameConrenameConDeclFieldFieldrenameLFieldOcc renameSig renameForD renameInstDrenameClsInstDrenameTyFamInstDrenameLTyFamInstEqnrenameLTyFamDefltEqnrenameDataFamInstDrenameImplicitrenameWcrenameDocInstancerenameExportItem renameSub$fApplicativeRnM $fFunctorRnM $fMonadRnMparseKeyparseModuleHeaderRdrName GlobalRdrEnv outOfScopeprocessDocStringsprocessDocStringParasprocessDocStringprocessModuleHeaderRebindRenameNameRep FastStringOccNameGHC.BaseStringcontainers-0.5.7.1 Data.Set.BaseSet specialize specialize'specializeTyVarBndrsspecializeInstHeadsugarparseTupleArity freeVariables freshName RenameEnvrneFVrneCtxspecializePseudoFamilyDecl specializeSig sugarLists sugarTuplessugarOperators getNameRep nameRepString stringNameRepsetInternalNameRepsetInternalOccName renameLTypes renameContext renameNamerebindrebindLTyVarBndrsrebindTyVarBndr rebindName reuseName takenNames findFreshNamealternativeNamesalternativeNames'located tyVarName WithinTypeImplicitizeForAllDeleteTopLevelQuantification synifyTyConSynifyTypeStatetyThingToLHsDeclsynifyAxBranch synifyAxiomsynifyInjectivityAnnsynifyFamilyResultSig synifyDataCon synifyName synifyIdSig synifyCtx synifyTyVars synifyTyVar synifySigTypesynifySigWcTypesynifyPatSynSigType synifyTypesynifyPatSynType synifyTyLit synifyKindSigsynifyInstHead synifyFamInstcreateInterfaceGHCTypecheckedModulemkMapsMaps subordinatestypeDocs classDeclstopDeclsmkFixMapungroupHsGroupmkDecls sortByLoc filterDecls filterClasses collectDocs mkExportItemshiValExportItemSrcLocSrcSpan lookupDocs moduleExports extractDeclpruneExportItems findNamedDoc mkAliasMaplookupModuleDyn mkWarningMap moduleWarning parseWarning mkDocOpts parseOptionhiDeclfullModuleContents extractRecSelmkVisibleNamesseqListmkMaybeTokenizedSrcmkTokenizedSrc SimpleType getAllInfo isNameHiddenisInstanceHidden SimpleTyLit ExportInfoModules ExportedNamesattachInstancesattachOrphanInstancesattachToExportItem instLookupinstHeadargCountsimplifysimplify_maybeinstFam funTyConName isTypeHiddenNotationRawInfixPrefix ppQualifyName ppOccName ppRdrNameppIPNameppUncheckedLink ppLDocName ppDocNameppFullQualName ppQualNameppNameppBinder ppBinderInfix ppBinderWith ppBinder' wrapInfixlinkId linkIdOcc linkIdOcc' ppModuleRef ModuleTreeNode mkModuleTree addToTrees mkSubTree splitModulecombineDocumentation docCodeBlockDocumentation.Haddock.Doc docParagraph docAppend emptyMetaDoc metaAppend metaDocAppend metaDocConcat metaConcat docConcat ppDocInstance ppDataHeaderppAppNameTypesppAppDocNameNames ppTypeApp StringContextPlainVerbMonoLaTeXppLaTeX haddockSty ppLaTeXTop ppLaTeXModule string_txtexportListItemprocessExports isSimpleSigisExportModule processExport ppDocGroup declNames forSummarymoduleLaTeXFilemoduleBasenameppDeclppTyFamppForppTySynppFunSig ppLPatSigppTypeOrFunSig ppTypeSigppTyVars tyvarNames declWithDoc multiDeclmaybeDocrDoc ppClassHdrppFds ppClassDeclppDocInstancesisUndocdInstance ppInstDecl ppInstHeadlookupAnySubdoc ppDataDecl ppConstrHdrppSideBySideConstrppSideBySideField ppLContextppLContextNoArrowppContextNoLocsMaybeppContextNoArrowppContextNoLocs ppContext pp_hs_contextppBang tupleParenspREC_TOPpREC_FUNpREC_OPpREC_CON maybeParenppLType ppLParendType ppLFunLhTypeppType ppParendType ppFunLhTypeppLKindppKind ppr_mono_lty ppr_mono_ty ppr_tylit ppr_fun_ty isInfixName ppSymName ppVerbOccName ppVerbDocName ppVerbRdrName ppDocBinder latexFilterlatexMonoFilter latexMungelatexMonoMungeparLatexMarkup latexMarkuprdrLatexMarkup docToLaTeXdocumentationToLaTeX rdrDocToLaTeXlatexStripTrailingWhitespace itemizedListenumeratedListdescriptionListttdeclttemphboldverbnl<->HacktoHackflatten hackMarkup UntouchedDoc HackAppendCollapsingHeader markupHackeddocToHtmlNoAnchors docToHtmlText.XHtml.Strict.Elementsanchor parHtmlMarkup renderMeta origDocToHtml rdrDocToHtml docElement docSection docSection_cleanupnonEmptySectionName subTableSrc subInstanceslinksSubDeclminiBody sectionDiv sectionNamedivPackageHeader divContentdivModuleHeader divFooterdivTableOfContentsdivDescription divSynopsis divInterfacedivIndex divAlphabet divModuleList shortDeclList shortSubDecls divTopDecl divSubDeclssubDlistsubTablesubBlock subArgumentssubAssociatedTypessubConstructors subFields subEquationssubOrphanInstances subInstHeadsubInstDetailssubFamInstDetailssubInstSection instAnchorId subMethods subMinimaldeclElem topDeclElemppFamDeclBinderWithVarsppDataBinderWithVars ppLFunSig ppSigLikeppForAll ppFixitiesppTyName ppSimpleSig ppFamilyInfo ppTyFamHeader ppResultSigppPseudoFamilyHeaderppInjectivityAnnppPseudoFamilyDecl ppAssocTypeppAppDocNameTyVarBndrs ppHsContextppShortClassDecl ppInstancesppOrphanInstancesppInstanceAssocTysppInstanceSigs instanceIdppShortDataDecl ppShortConstrppShortConstrParts ppShortFieldpREC_CTX ppCtxType ppHsTyVarBndr ppForAllPartppHtml copyHtmlBitsheadHtml srcButton wikiButtoncontentsButton indexButtonbodyHtml moduleInfoppHtmlContents ppPrologue ppModuleTree mkNodeListmkNode ppHtmlIndex ppHtmlModuleppHtmlModuleMiniSynopsis ifaceToHtml miniSynopsisprocessForMiniSynopsis ppNameMinippTyClBinderWithVarsMinippModuleContentsnumberSectionHeadings nothingIf processDeclprocessDeclOneLiner groupHeadinggroupTag OnDiskName BinDictionary bin_dict_next bin_dict_mapBinSymbolTablebin_symtab_nextbin_symtab_mapifModuleifUnitIdbinaryInterfaceMagicbinaryInterfaceVersion#binaryInterfaceVersionCompatibilityinitBinMemSizewriteInterfaceFileputName putFastStringputSymbolTablegetSymbolTablefromOnDiskName serialiseName$fBinaryDocName$fBinaryHaddockModInfo $fBinaryDocH$fBinaryMetaDoc $fBinaryMeta$fBinaryHeader$fBinaryPicture$fBinaryHyperlink$fBinaryExample$fBinaryDocOption$fBinaryInstalledInterface$fBinaryInterfaceFile $fBinaryMapbuildHomeLinks createIfaces0 createIfaces processModule withTempDirhandleNormalExceptionswarningsmodulePackageInfowithGhc'GhcMonadGhchypSrcWarningshandleTopExceptionshandleHaddockExceptionshandleGhcExceptionsreadPackagesAndProcessModules renderStepreadInterfaceFilesgetHaddockLibDir shortcutFlagsupdateHTMLXRefs getPrologue