[Template-haskell] RE: Declaration reordering
Simon Peyton-Jones
simonpj@microsoft.com
Fri, 14 Feb 2003 10:20:56 -0000
I'm not sure I do agree that it's worthwhile. At least, of course it
would be nice but the question is whether it's worth the bother. Why
are you keen on it?
You sent your original message to ghc-users; perhaps you'd like to
summarise for the TH list.
Your first option looks best. Indeed, each decl has its SrcLoc which
includes a line number, so perhaps you could unscramble them that way.
You are welcome to have a go; if you need help figuring out where, I'll
help.
Simon
| -----Original Message-----
| From: Ian Lynagh [mailto:igloo@earth.li]
| Sent: 14 February 2003 03:11
| To: Simon Peyton-Jones
| Subject: Re: Declaration reordering
|=20
| On Thu, Feb 13, 2003 at 09:16:46AM -0000, Simon Peyton-Jones wrote:
| >
| > The renamer performs a strongly-connected component analysis of
| > declarations. Reason: it's the standard way to get maximal
| > polymorphism. It's even part of the language specification.
| >
| > It'd be quite tricky to un-do that stuff before doing the quotation
| > part. So I'm really not sure how to tackle your problem.
|=20
| Do you agree that it is worthwhile?
|=20
| The possibilities that spring to mind are:
|=20
| * tagging each declaration with its position in the list and sorting
| them before returning them. The only arguments against this are it
| adds a bit of code and will have a time/space impact (but I'd have
| thought negligible, especially if the tagging was done strictly).
|=20
| * Keeping a copy of the original input around to pass back. Doubles
| space used by declaration lists and I suspect will have problems
with
| right infix operators.
|=20
| * Doing the SCC analysis and type checking on a copy and throwing it
| away afterwards. Would also have the problems of the above and is
| probably more complicated to implement.
|=20
|=20
| Thanks
| Ian