Re: GHC API (parsing)

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haskell-src-exts-...
interesting, I'll look into that. * it's not exactly a drop-in replacement for Language.Haskell.* ? (HsNewTypeDecl is different?) * for the others, number of constructor arguments does not match, e.g. `HsConDecl' should have 2 arguments, but has been given 3 * how is your parser tied to ghc? I.e. what happens if the next ghc release introduces new syntax? general question * is there any parser that keeps comments (i.e. makes AST nodes from them)? what parser does Haddock use? Best regards, J.W.

* it's not exactly a drop-in replacement for Language.Haskell.* ? (HsNewTypeDecl is different?)
* for the others, number of constructor arguments does not match, e.g. `HsConDecl' should have 2 arguments, but has been given 3
Indeed it is like you say, these are pragmatic choices. The extensions introduce new requirements, and the choice was between modelling only the general case, or separating the H98 case and the extension as two different constructors. I chose the former, since I believe anyone using this library would want to use the extensions anyway, and choosing the latter would have meant a lot of extra boilerplate code (for the user, not me).
* how is your parser tied to ghc? I.e. what happens if the next ghc release introduces new syntax?
It is not at all tied to ghc, other than that I try to keep up with the major extensions that ghc provides. There are some things in ghc that my library does not model, e.g. arrows syntax (patches welcome!). But if there's anything specific that you need that isn't already in there, drop me a feature request and I'll try to fix it for you. Cheers, /Niklas

general question
* is there any parser that keeps comments (i.e. makes AST nodes from them)? what parser does Haddock use?
you might want to add your voice and cc to Ticket #1886 ;-) "GHC API should preserve and provide access to comments" http://hackage.haskell.org/trac/ghc/ticket/1886 claus

"GHC API should preserve and provide access to comments" http://hackage.haskell.org/trac/ghc/ticket/1886
What does this lead to? Introspection? So you can get haddock comments from ghci? This would be interesting Marc Weber

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Introspection? So you can get haddock comments from ghci?
see also http://hackage.haskell.org/trac/ghc/ticket/2168 best regards, j.w. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIA8PH3ZnXZuOVyMIRAjnyAJ4qtDaBWUbBIuWGfZnP4yboC08FNQCfYvuX PZmW/t7u1Qnhjxzx4Lz+pys= =XPmx -----END PGP SIGNATURE-----
participants (4)
-
Claus Reinke
-
Johannes Waldmann
-
Marc Weber
-
Niklas Broberg