Haddock GADTs Hack

Ashley Yakeley <[email protected]> Tue, 06 Feb 2007 23:17:59 -0800
Newsgroups gmane.comp.lang.haskell.haskelldoc
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------040105030903000800010504
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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

--------------040105030903000800010504
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
	name="gadt-hack.dpatch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="gadt-hack.dpatch"


New patches:

[hack to parse GADTs, though with incorrect constructor types
Ashley Yakeley <[email protected]>**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 <[email protected]>**20070115171157] 
[tweaked tyvarop precedence
Conal Elliott <[email protected]>**20070110002300] 
[added infix type operators
Conal Elliott <[email protected]>**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 <[email protected]>**20070109131444] 
[allow blank lines inside a @...@ code block
Simon Marlow <[email protected]>**20070109131434] 
[Fix up a case of extra vertical space after a code block
Simon Marlow <[email protected]>**20070105111341
 
 
] 
[TODO: do something better about re-exported symbols from another package
Simon Marlow <[email protected]>**20061215155200] 
[fix <<URL>> image markup
Simon Marlow <[email protected]>**20061208100637] 
[add todo item for --maintainer
Simon Marlow <[email protected]>**20061206160507] 
[fix --use-package error message
Simon Marlow <[email protected]>**20061013105135] 
[Cabal's sdist does not generate "-src.tar.gz" files, but ".tar.gz" ones
[email protected]**20061012152823] 
[Rename haddock.js to haddock-util.js
Simon Marlow <[email protected]>**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 <[email protected]>**20061010122403] 
Patch bundle hash:
4e32d45ab20492317a114d712a71c3295c6975d3

--------------040105030903000800010504
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
HaskellDoc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskelldoc

--------------040105030903000800010504--