GHC: Ticket #12694: GHC HEAD no longer reports inaccessible code
http://trac.haskell.org/trac/ghc/ticket/12694
<p>
Given this A.hs:
</p>
<pre class="wiki">{# LANGUAGE GADTs #}
module A where
f :: Bool ~ Int => a > b
f x = x
</pre><p>
I get:
</p>
<pre class="wiki">ezyang@sabre:~$ ghchead version
The Glorious Glasgow Haskell Compilation System, version 8.1.20161010
ezyang@sabre:~$ ghchead make A.hs
[1 of 1] Compiling A ( A.hs, A.o )
A.hs:4:1: warning: [Woverlappingpatterns]
Pattern match is redundant
In an equation for ‘f’: f x = ...
</pre><p>
In contrast:
</p>
<pre class="wiki">ezyang@sabre:~$ ghc8.0 make A.hs
[1 of 1] Compiling A ( A.hs, A.o )
A.hs:3:6: error:
• Couldn't match type ‘Bool’ with ‘Int’
Inaccessible code in
the type signature for:
f :: Bool ~ Int => a > b
• In the ambiguity check for ‘f’
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature:
f :: Bool ~ Int => a > b
</pre><p>
Is this expected? I'd expect at least a warning!
</p>
enusGHChttp://trac.haskell.org/trac/ghc/chrome/site/ghc_logo.png
http://trac.haskell.org/trac/ghc/ticket/12694
Trac 1.2.2simonpjThu, 13 Oct 2016 09:18:59 GMT
http://trac.haskell.org/trac/ghc/ticket/12694#comment:1
http://trac.haskell.org/trac/ghc/ticket/12694#comment:1
<p>
See <a class="closed ticket" href="http://trac.haskell.org/trac/ghc/ticket/12466" title="#12466: bug: Typechecker regression: Inaccessible code in a type expected by the context (closed: fixed)">#12466</a> for an extended discussion. I wish I had a better solution.
</p>
<p>
Simon
</p>
TicketezyangThu, 13 Oct 2016 21:48:42 GMT
http://trac.haskell.org/trac/ghc/ticket/12694#comment:2
http://trac.haskell.org/trac/ghc/ticket/12694#comment:2
<p>
I would suggest putting it under a <code>W</code> option but you've mentioned it in the ticket; in any case, I doubt it will help anyone who doesn't already know what's going on. I ran into this because I was debugging something that was marked insoluble that wasn't (very confusing! At least the "warning" is printed in <code>ddumptctrace</code>.)
</p>
TicketRyanGlScottFri, 27 Jul 2018 20:55:38 GMTkeywords, related set
http://trac.haskell.org/trac/ghc/ticket/12694#comment:3
http://trac.haskell.org/trac/ghc/ticket/12694#comment:3
<ul>
<li><strong>keywords</strong>
<em>PatternMatchWarnings</em> added
</li>
<li><strong>related</strong>
set to <em>#12466, #11066, #13766</em>
</li>
</ul>
TicketRyanGlScottFri, 27 Jul 2018 20:57:50 GMT
http://trac.haskell.org/trac/ghc/ticket/12694#comment:4
http://trac.haskell.org/trac/ghc/ticket/12694#comment:4
<p>
It seems that in GHC 8.2, this errors again:
</p>
<pre class="wiki">$ /opt/ghc/8.4.3/bin/ghc Bug.hs
[1 of 1] Compiling A ( Bug.hs, Bug.o )
Bug.hs:4:7: error:
• Could not deduce: a ~ b
from the context: Bool ~ Int
bound by the type signature for:
f :: forall a b. (Bool ~ Int) => a > b
at Bug.hs:3:125
‘a’ is a rigid type variable bound by
the type signature for:
f :: forall a b. (Bool ~ Int) => a > b
at Bug.hs:3:125
‘b’ is a rigid type variable bound by
the type signature for:
f :: forall a b. (Bool ~ Int) => a > b
at Bug.hs:3:125
• In the expression: x
In an equation for ‘f’: f x = x
• Relevant bindings include
x :: a (bound at Bug.hs:4:3)
f :: a > b (bound at Bug.hs:4:1)

4  f x = x
 ^
</pre><p>
Perhaps this can be closed, then?
</p>
Ticket