[GHC] #12466: Typechecker regression: Inaccessible code in a type expected by the context
GHC
ghc-devs at haskell.org
Thu Aug 25 15:13:48 UTC 2016
#12466: Typechecker regression: Inaccessible code in a type expected by the context
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner:
Type: bug | Status: new
Priority: highest | Milestone: 8.0.2
Component: Compiler (Type | Version: 8.1
checker) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
Currently
{{{
foo :: (Char ~ Int => Int) -> a -> a
foo _ a2 = a2
}}}
gives a similar message. Is that reasonable? The argument to `foo` can't
be called.
Instance decls are a bit different because you can change the type
signature. Eg here is a simpler example
{{{
class C a where
foo :: (a~Int) => a -> a
instance C Bool where
foo = undefined
}}}
The instance decl is rejected, by both GHC 7.10 and HEAD. But of course
there's nothing you can do about it. `foo` can't be called, but it needs
something for the method `foo`. (It works when you leave out the
definition of `foo` altogether, but I think only by accident.)
What we need is NOT to complain about inconsistent 'givens' when
typechecking instance methods. And certainly not to fail.
Would that serve? It would sadly mean that inaccessible code somewhere
deep in the body of an instance method wouldn't be reported, but maybe
that's a lesser evil.
I have not followed all this stuff about `Conjoined`. Is it all the same
question?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12466#comment:22>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list