
#12466: Typechecker regression: Inaccessible code in a type expected by the context -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.2.1 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: | -------------------------------------+------------------------------------- Description changed by simonpj: @@ -31,0 +31,3 @@ + + The reason HEAD fails to compile `lens`, but GHC 8.0.1 works, is because + the fix for #12220 is in HEAD, but not in 8.0.1. New description: The following compiles with GHC 8.0.1 and earlier, but not with GHC HEAD: {{{#!hs {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-} module Bug where class Foo a where foo :: (a ~ Int => Int) -> a -> a foo _ a2 = a2 instance Foo Char }}} {{{ $ /opt/ghc/head/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:9:10: error: • Couldn't match type ‘Char’ with ‘Int’ Inaccessible code in a type expected by the context: Char ~ Int => Int • In the expression: Bug.$dmfoo @Char In an equation for ‘foo’: foo = Bug.$dmfoo @Char In the instance declaration for ‘Foo Char’ }}} This causes `lens-4.14` to [https://github.com/ekmett/lens/issues/667 fail to build] with GHC HEAD. The reason HEAD fails to compile `lens`, but GHC 8.0.1 works, is because the fix for #12220 is in HEAD, but not in 8.0.1. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12466#comment:28 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler