[GHC] #7862: Could not deduce (A) from the context (A, ...)
GHC
ghc-devs at haskell.org
Sun Feb 7 20:42:17 UTC 2016
#7862: Could not deduce (A) from the context (A, ...)
-------------------------------------+-------------------------------------
Reporter: alang9 | Owner:
Type: bug | Status: closed
Priority: normal | Milestone: 8.0.1
Component: Compiler (Type | Version: 7.8.3
checker) |
Resolution: fixed | Keywords:
Operating System: Linux | Architecture: x86_64
| (amd64)
Type of failure: GHC rejects | Test Case: indexed-
valid program | types/should_compile/T7862
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by thomie):
* status: new => closed
* resolution: => fixed
* milestone: => 8.0.1
Comment:
This was fixed in commit a6f0f5ab45b2643b561e0a0a54a4f14745ab2152:
{{{
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Tue Dec 23 15:39:50 2014 +0000
Eliminate so-called "silent superclass parameters"
The purpose of silent superclass parameters was to solve the
awkward problem of superclass dictinaries being bound to bottom.
See THE PROBLEM in Note [Recursive superclasses] in TcInstDcls
Although the silent-superclass idea worked,
* It had non-local consequences, and had effects even in Haddock,
where we had to discard silent parameters before displaying
instance declarations
* It had unexpected peformance costs, shown up by Trac #3064 and its
test case. In monad-transformer code, when constructing a Monad
dictionary you had to pass an Applicative dictionary; and to
construct that you neede a Functor dictionary. Yet these extra
dictionaries were often never used. (All this got much worse when
we added Applicative as a superclass of Monad.) Test T3064
compiled *far* faster after silent superclasses were eliminated.
* It introduced new bugs. For example SilentParametersOverlapping,
T5051, and T7862, all failed to compile because of instance
overlap
directly because of the silent-superclass trick.
So this patch takes a new approach, which I worked out with Dimitrios
in the closing hours before Christmas. It is described in detail
in THE PROBLEM in Note [Recursive superclasses] in TcInstDcls.
Seems to work great!
Quite a bit of knock-on effect
* The main implementation work is in tcSuperClasses in TcInstDcls
Everything else is fall-out
* IdInfo.DFunId no longer needs its n-silent argument
* Ditto IDFunId in IfaceSyn
* Hence interface file format changes
* Now that DFunIds do not have silent superclass parameters, printing
out instance declarations is simpler. There is tiny knock-on effect
in Haddock, so that submodule is updated
* I realised that when computing the "size of a dictionary type"
in TcValidity.sizePred, we should be rather conservative about
type functions, which can arbitrarily increase the size of a type.
Hence the new datatype TypeSize, which has a TSBig constructor for
"arbitrarily big".
* instDFunType moves from TcSMonad to Inst
* Interestingly, CmmNode and CmmExpr both now need a non-silent
(Ord r) in a couple of instance declarations. These were previously
silent but must now be explicit.
* Quite a bit of wibbling in error messages
}}}
The test output is now:
{{{
T7862.hs:23:10: Warning:
No explicit implementation for
‘+’, ‘*’, ‘abs’, ‘signum’, ‘fromInteger’, and (either ‘negate’
or
‘-’)
In the instance declaration for ‘Num (Tower s a)’
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7862#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list