Haddock GADTs Hack

Ashley Yakeley ashley at semantic.org
Wed Feb 7 02:17:59 EST 2007


Included is a hack to allow haddock to parse GADTs. There are two 
problems with it:

1. I don't think you can add doc comments to the constructors.

2. The shown types are wrong: the whole type of the constructor is shown 
as if it were the type of a single argument. Fixing this will presumably 
involve adding another constructor to HsConDecl to represent GADT 
constructors.

It wouldn't be appropriate to release haddock in this state, but I think 
it's helpful for those of us who could get no doc at all just because we 
have a GADT in our code.

-- 
Ashley Yakeley
Seattle, WA
-------------- next part --------------

New patches:

[hack to parse GADTs, though with incorrect constructor types
Ashley Yakeley <ashley at semantic.org>**20070207070109] {
hunk ./src/HsParser.ly 480
+> 	  | 'where' gadtconstrlist    { addConDocs $2 Nothing }
hunk ./src/HsParser.ly 497
+> gadtconstrlist :: { [HsConDecl] }
+>	: '{' gadtconstrs '}'			{ $2 }
+>	|     layout_on  gadtconstrs close	{ $2 }
+
+> gadtconstrs :: { [HsConDecl] }
+>	: gadtconstr ';' gadtconstrs		{ $1 : $3 }
+>	| ';' gadtconstrs			{ $2 }
+>	| gadtconstr				{ [$1] }
+>	| {- empty -}			{ [] }
+
+> gadtconstr :: { HsConDecl }
+>	: con srcloc '::' ctypedoc	{ HsConDecl $2 $1 [] [] [HsUnBangedTy $4] Nothing }
+
}

Context:

[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:
4e32d45ab20492317a114d712a71c3295c6975d3


More information about the HaskellDoc mailing list