wondering about -ddump-parsed, rn
simonpj at microsoft.com
Thu Aug 9 05:13:27 EDT 2007
-ddump-parsed shows the program after parsing. All operator application are parsed *left-associative* with one precedence. Then the renamer re-associates them to respect precedence and associativity.
So, no, -ddump-parsed will definitely not give syntactically valid Haskell. -ddump-rn probably will though.
| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org [mailto:glasgow-haskell-users-bounces at haskell.org] On
| Behalf Of Isaac Dupree
| Sent: 09 August 2007 00:44
| To: GHC Users
| Subject: wondering about -ddump-parsed, rn
| Is ghc -ddump-parsed supposed to give parse-syntactically valid Haskell?
| It nearly does - the only way I've seen it not do so is infix
| type-signatures and some infix definitions. Answer: no, look at what it
| does to the operators with fixities. But, -ddump-rn seems better...
| (@@@) :: a
| a @@@ b = a + b : a + b
| ==================== Parser ====================
| @@@ :: a
| @@@ a b = ((a + b) : a) + b
| ==================== Renamer ====================
| @@@ :: a
| @@@ a b = (a + b) : (a + b)
| It would be interesting if that was a source-to-source transformation on
| Haskell: a way to delete all the comments and formatting of the original
| file. Putting parentheses around infix used as prefix would be nice.
| Of course... the renamer output depends on other modules, and must for
| the precise reason of imported fixity declarations! GHC isn't trying to
| do this so I really have no reason to ask it to :)
| P.S. this (-ddump-) is a nice way to see how some stages of GHC's
| processing are done, to get to know them a little, I think, after also
| looking through some code and Commentary
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at haskell.org
More information about the Glasgow-haskell-users