[GHC] #14559: When overlapping instances lead to a compile error, show import chains for the instances
GHC
ghc-devs at haskell.org
Wed Dec 6 09:05:20 UTC 2017
#14559: When overlapping instances lead to a compile error, show import chains for
the instances
-------------------------------------+-------------------------------------
Reporter: Artyom.Kazak | Owner: (none)
Type: feature | Status: new
request |
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Here's an example from work:
{{{
• Overlapping instances for ToJSON BackupPhrase
arising from a use of 'aesonRoundtripProp'
Matching instances:
instance ToJSON BackupPhrase
-- Defined in 'Cardano.Wallet.Orphans.Aeson'
instance ToJSON BackupPhrase
-- Defined in 'Pos.Wallet.Aeson.ClientTypes'
}}}
Currently resolving such issues requires looking carefully at all imports
and trying to guess which ones bring the instance into scope. It'd be
quite helpful if the error was explicit about the import chain:
{{{
• Overlapping instances for ToJSON BackupPhrase
arising from a use of 'aesonRoundtripProp'
Matching instances:
instance ToJSON BackupPhrase
-- Defined in 'Cardano.Wallet.Orphans.Aeson',
-- imported by 'Cardano.Wallet.Orphans'
instance ToJSON BackupPhrase
-- Defined in 'Pos.Wallet.Aeson.ClientTypes',
-- imported by 'Pos.Wallet.Web.Mode',
-- and then by 'Cardano.Wallet.API.V1.Migration'
}}}
Thoughts?
I'm worried about two things here:
1. Might these chains get too long?
2. Is it sufficiently obvious that “imported by `A` and then by `B`”
means that you have imported `B` and `B` imported `A`, and not vice-versa?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14559>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list