[GHC] #13061: Incorrect constraints given single flexible undecidable instance
GHC
ghc-devs at haskell.org
Tue Jan 3 20:46:23 UTC 2017
#13061: Incorrect constraints given single flexible undecidable instance
-------------------------------------+-------------------------------------
Reporter: JCarr | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.0.1
checker) | Keywords: Constraint,
Resolution: | UndecidableInstances,
| FlexibleInstances
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 JCarr:
@@ -16,1 +16,2 @@
- If we add: {{{#!hs
+ If we add:
+ {{{#!hs
New description:
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#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list