[Haskell] Haddock and type operators

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Wed Apr 18 17:30:23 EDT 2007

Am Mittwoch, 18. April 2007 19:29 schrieb Wolfgang Jeltsch:
> Hello everybody,
> I urgently need Haddock support for type operators like in the following
> code snippet:
>     infix  2 :::, :=
>     infixl 9 :.:
>     data name ::: value = name := value
>     newtype Composition f g a = Composition { runComposition :: f (g a) }
>     type (:.:) = Composition
> Does anybody know whether this is easy to implement or whether there is a
> quick hack to make this work?  Can I do the hacking myself or is deeper
> knowledge of the Haddock source code necessary to provide this feature?
> Thank you in advance for any help.
> Best wishes,
> Wolfgang

Hello again,

after looking a bit at the source code and coming to the conclusion that it 
doesn’t look too scary ;-) , I’ve started to make the necessary modifications 
myself.  The result of my hacking is attached as a darcs patch.

Note that this is really a hack.  One additional parser conflict is added.  
Neither the parser nor the renderer considers any fixity declarations.  Infix 
operator applications are always rendered without parantheses.  But for me it 
works! :-) 

Best wishes,
-------------- next part --------------

New patches:

[some hackery to support type constructor operators
Wolfgang Jeltsch <g9ks157k at acme.softbase.org>**20070418212824] {
hunk ./src/HaddockHtml.hs 1022
+  hsep [ppHsBType a, toHtml sym, ppHsBType b]
+ppHsBType (HsTyApp (HsTyApp (HsTyCon opName@(Qual _ (HsVarName (HsSymbol sym)))) a) b) =
+  hsep [ppHsBType a, ppHsQName opName, ppHsBType b]
+ppHsBType (HsTyApp (HsTyApp (HsTyCon (UnQual (HsVarName (HsSymbol sym)))) a) b) =
hunk ./src/HsParser.ly 268
+>	| '(' consym ')'		{ $2 }
hunk ./src/HsParser.ly 411
+>	| btype qconop btype		{ HsTyApp (HsTyApp (HsTyCon $2) $1) $3 }
hunk ./src/HsParser.ly 421
+>	| btype qconop type1		{ HsTyApp (HsTyApp (HsTyCon $2) $1) $3 }
hunk ./src/HsParser.ly 442
+>	| '(' qconsym ')'		{ $2 }
hunk ./src/HsParser.ly 473
+>	| tyvar conop tyvar		{ ($2,[$1,$3]) }
+>	| '(' consym ')' tyvars		{ ($2,$4) }


[Add a flag --allow-missing-html
Ian Lynagh <igloo at earth.li>**20070307145955
 With this flag, haddock ignores whether or not the HTML directory of
 packages depended upon exists. We need this when haddocking groups of
 packages that aren't installed yet.
[Add a --ghc-pkg flag
Ian Lynagh <igloo at earth.li>**20070307144253] 
[added substitution %{FILE///c}
Conal Elliott <conal at conal.net>**20070214215400] 
[Do not create empty tables for data declarations which don't have any constructors, instances or comments. Gets better HTML 4.01 compliance
Neil Mitchell**20070206174912] 
[infix type op precedence tweak, ppHsNameAsVar 
Conal Elliott <conal at conal.net>**20070115171157] 
[tweaked tyvarop precedence
Conal Elliott <conal at conal.net>**20070110002300] 
[added infix type operators
Conal Elliott <conal at conal.net>**20070105172038] 
[Make the search box in a form so that enter does the default search
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070112125817] 
[Make the max number of results 75 instead of 50, to allow map searching in the base library to work
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070112122501] 
[Rewrite much of the index searching code, previously was too slow to execute on the base library with IE, the new version guarantees less than O(log n) operations be performed, where n is the number in the list (before was always O(n))
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070112121746] 
[Make the index be in case-insensitive alphabetic order
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070111185143] 
[Change from tabs to spaces in the ppHtmlIndex function
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070111182244] 
[Delete more stuff that is no longer required
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070111182119] 
[Delete dead code, now there is only one index page
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070111181746] 
[Add searching on the index page
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070111170709] 
[Never do spliting index files into many
Neil Mitchell <http://www.cs.york.ac.uk/~ndm/>**20070111154115] 
[add test for blank lines inside @...@ code block
Simon Marlow <simonmar at microsoft.com>**20070109131444] 
[allow blank lines inside a @...@ code block
Simon Marlow <simonmar at microsoft.com>**20070109131434] 
[Fix up a case of extra vertical space after a code block
Simon Marlow <simonmar at microsoft.com>**20070105111341
[TODO: do something better about re-exported symbols from another package
Simon Marlow <simonmar at microsoft.com>**20061215155200] 
[fix <<URL>> image markup
Simon Marlow <simonmar at microsoft.com>**20061208100637] 
[add todo item for --maintainer
Simon Marlow <simonmar at microsoft.com>**20061206160507] 
[fix --use-package error message
Simon Marlow <simonmar at microsoft.com>**20061013105135] 
[Cabal's sdist does not generate "-src.tar.gz" files, but ".tar.gz" ones
sven.panne at aedion.de**20061012152823] 
[Rename haddock.js to haddock-util.js
Simon Marlow <simonmar at microsoft.com>**20061011141737
 haddock.js will be run automatically by Windows when you type
 'haddock' if it is found on the PATH, so rename to avoid confusion.
 Spotted by Adrian Hey.
[TAG 0.8 release
Simon Marlow <simonmar at microsoft.com>**20061010122403] 
Patch bundle hash:

More information about the Haskell mailing list