Adding location information to derived code

Simon Peyton Jones simonpj at microsoft.com
Wed Jun 10 21:36:30 UTC 2015


| not sure whether it is a
| good idea to add location information to automatically generated code.

I think it would be an excellent idea.

| Do we make any assumptions
| that derived code should have no location information?

I don't think so.

Please open a ticket for your test case, and (if you can) fix it.  The location for the implicit instance should jolly well be the instance declaration for 'instance C Int'!

Thanks for spotting this.

Simon

| -----Original Message-----
| From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Jan
| Stolarek
| Sent: 10 June 2015 14:12
| To: ghc-devs at haskell.org
| Subject: Adding location information to derived code
| 
| Hi devs,
| 
| say I have:
| 
|   class C a where
|     type F a
|     type F a = a
| 
|   instance C Int
| 
| During compilation of "instance C Int" GHC will derive a default
| associated type instance "F Int =
| Int". That instance has no location information and so any errors that it
| might cause will have a
| very uninformative source code location 1:1. I want to fix this but I'm
| not sure whether it is a
| good idea to add location information to automatically generated code. Do
| we make any assumptions
| that derived code should have no location information?
| 
| Janek
| 
| ---
| Politechnika Łódzka
| Lodz University of Technology
| 
| Treść tej wiadomości zawiera informacje przeznaczone tylko dla adresata.
| Jeżeli nie jesteście Państwo jej adresatem, bądź otrzymaliście ją przez
| pomyłkę
| prosimy o powiadomienie o tym nadawcy oraz trwałe jej usunięcie.
| 
| This email contains information intended solely for the use of the
| individual to whom it is addressed.
| If you are not the intended recipient or if you have received this
| message in error,
| please notify the sender and delete it from your system.
| _______________________________________________
| ghc-devs mailing list
| ghc-devs at haskell.org
| http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


More information about the ghc-devs mailing list