[GHC] #11115: Indicate missing associated type instances
GHC
ghc-devs at haskell.org
Fri Nov 20 00:17:02 UTC 2015
#11115: Indicate missing associated type instances
-------------------------------------+-------------------------------------
Reporter: rimmington | Owner:
Type: feature | Status: new
request |
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.2
(Type checker) |
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:
-------------------------------------+-------------------------------------
If there is no matching instance for a typeclass that defines an
associated type, GHC cannot further reduce an application of that
associated type. For nested type family applications, this produces rather
large error messages, eg:
{{{
<interactive>:98:20:
Couldn't match type ‘units-2.3:Data.Metrology.Factor.Normalize
(Data.Metrology.Suspicious.Poly.SurfaceUnitFactorsOf
(Data.Singletons.Prelude.Tuple.Snd
(Data.Metrology.Suspicious.Poly.SplitPrefix
(PrefixExp Deci) Deci Core))
units-2.3:Data.Metrology.Factor. at -
'['units-2.3:Data.Metrology.Factor.F
Core
('Data.Metrology.Z.S
'Data.Metrology.Z.Zero)])’
with ‘'[]’
In the expression: (25 %> centi Core) `ceilToUnit` deci Core
In an equation for ‘it’:
it = (25 %> centi Core) `ceilToUnit` deci Core
}}}
The cause of the above error message is that `Deci` is not a member of the
typeclass `ExpUnitPrefix` that defines the associated type `PrefixExp`.
Unfortunately this is not clear at all from the error message, and adding
additional class constraints to the appropriate functions doesn't improve
things.
It would be nice if GHC pointed out that there is no `ExpUnitPrefix Deci`
instance, or at least that `PrefixExp Deci` cannot be further reduced. I
imagine this would be useful for open type families as well, but I can't
comment personally.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11115>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list