[GHC] #13061: Incorrect constraints given single flexible undecidable instance
GHC
ghc-devs at haskell.org
Tue Jan 3 20:46:00 UTC 2017
#13061: Incorrect constraints given single flexible undecidable instance
-------------------------------------+-------------------------------------
Reporter: JCarr | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
(Type checker) |
Keywords: Constraint, | Operating System: Unknown/Multiple
UndecidableInstances, |
FlexibleInstances |
Architecture: | Type of failure: GHC rejects
Unknown/Multiple | valid program
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
If a class has an instance in the form F a => G a in its file, and no
other instances, then the functions in G a will have the constraint F a,
rather than G a.
Example file
{{{#!hs
{-# LANGUAGE FlexibleInstances, UndecidableInstances #-}
class A a where
f :: a -> a
instance {-# OVERLAPPABLE #-} Eq a => A a where
f = id
}}}
f will have type Eq a => a -> a -> Bool
If we add: {{{#!hs
instance A Int where
f = id
}}}
Then f will have the type A a => a -> a -> Bool.
A function of type A a => ... will always be rejected unless Eq is also
included
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13061>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list