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.

| 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@haskell.org] On Behalf Of Jan | Stolarek | Sent: 10 June 2015 14:12 | To: ghc-devs@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@haskell.org | http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

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'! The fix is trivial and I have it on my injectivity branch. I'm really not sure if that problem manifests itself without injectivity.
Janek
Thanks for spotting this.
Simon
| -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces@haskell.org] On Behalf Of Jan | Stolarek | Sent: 10 June 2015 14:12 | To: ghc-devs@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@haskell.org | http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
--- 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.
participants (2)
-
Jan Stolarek
-
Simon Peyton Jones