Skip to content

GHC HEAD no longer reports inaccessible code

Given this A.hs:

{-# LANGUAGE GADTs #-}
module A where
f :: Bool ~ Int => a -> b
f x = x

I get:

ezyang@sabre:~$ ghc-head --version
The Glorious Glasgow Haskell Compilation System, version 8.1.20161010
ezyang@sabre:~$ ghc-head --make A.hs 
[1 of 1] Compiling A                ( A.hs, A.o )

A.hs:4:1: warning: [-Woverlapping-patterns]
    Pattern match is redundant
    In an equation for ‘f’: f x = ...

In contrast:

ezyang@sabre:~$ ghc-8.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

Is this expected? I'd expect at least a warning!

Trac metadata
Trac field Value
Version 8.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC goldfire
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information