[GHC] #10087: DefaultSignatures: error message mentions internal name
GHC
ghc-devs at haskell.org
Wed Apr 20 16:28:35 UTC 2016
#10087: DefaultSignatures: error message mentions internal name
-------------------------------------+-------------------------------------
Reporter: andreas.abel | Owner:
Type: feature request | Status: infoneeded
Priority: normal | Milestone:
Component: Compiler (Type | Version: 7.8.4
checker) |
Resolution: | Keywords: Generics
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: Other | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
The real issue is this: what error message do we *want* from the erroneous
program in the Description?
There really is an error:
* the generic default method is used in the `instance` because no
explicit method for `reflexive` is given.
* but the generic default requires `(Eq a)` and that is not available.
So we need something like
{{{
No instance for (Eq D) arising from
the generic default method for `reflexive`
In the instance declaration for ‘C D’
}}}
Would that be about right?
The difficulty is that for generic defaults, for the class decl we
generate
{{{
$gdmreflexive :: (C a, Eq a) => a -> Bool
$gdmreflexive x = x==x
}}}
This part is fine.
For the missing method binding in the `instance` we generate
we generate ''source code'' looking like
{{{
reflexive = $gdmreflexive
}}}
Now we typecheck that, which gives the error message. And you can see it
might be hard to generate the "right" error message.
Better perhaps to do what happens for non-generic default methods, which
is to generate typechecked code directly (and emit some constraints).
Compare what we do for the `Nothing` case of `DefMethInfo` in `tc_default`
in `tcMethods` in `TcInstDcls`.
Does that make sense?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10087#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list