[GHC] #12201: Wrong instance selection with overlapping instances and local bindings
GHC
ghc-devs at haskell.org
Fri Jun 17 03:02:28 UTC 2016
#12201: Wrong instance selection with overlapping instances and local bindings
-------------------------------------+-------------------------------------
Reporter: kanetw | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
(Type checker) |
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
test and test2 should have the same type, but it seems like the {-#
OVERLAPPING #-} instance is chosen prematurely.
{{{#!hs
{-# LANGUAGE NoMonomorphismRestriction, FlexibleContexts,
FlexibleInstances #-}
module Bug where
class A a where
class A a => B a where
data Foo s a
instance {-# OVERLAPPING #-} A (Foo Int Bool)
instance A (Foo s a)
instance B (Foo s a)
bar :: (A a, B a) => a
bar = undefined
helper :: Foo s Bool -> s -> Int
helper = undefined
{-
*Bug> :t test
test :: A (Foo s Bool) => s -> Int
-}
test = helper bar
{-
*Bug> :t test2
test2 :: s -> Int
-}
test2 = let foo = bar in helper foo
}}}
Compare with 7.10.3:
{{{
*Bug> :t test
test :: A (Foo s Bool) => s -> Int
*Bug> :t test2
test2 :: A (Foo s Bool) => s -> Int
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12201>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list