[GHC] #7296: ghc-7 assumes incoherent instances without requiring language `IncoherentInstances`
GHC
cvs-ghc at haskell.org
Thu Oct 4 14:50:05 CEST 2012
#7296: ghc-7 assumes incoherent instances without requiring language
`IncoherentInstances`
-----------------------------------------+----------------------------------
Reporter: maeder | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.6.1 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: GHC accepts invalid program | Testcase:
Blockedby: | Blocking:
Related: |
-----------------------------------------+----------------------------------
the attached examples works with ghc-7 and returns
{{{
*Main> a
[Spec1 Spec2]
*Main> b
[]
}}}
(One may wish that b also returned [Spec1 Spec2])
ghc-6 complains with
{{{
Splittable.hs:16:36:
Overlapping instances for Test a Spec2
arising from a use of `test' at Splittable.hs:16:36-43
Matching instances:
instance [overlap ok] Test a Spec2
-- Defined at Splittable.hs:20:13-24
instance [overlap ok] Test Bool Spec2
-- Defined at Splittable.hs:25:13-27
(The choice depends on the instantiation of `a'
To pick the first instance above, use -XIncoherentInstances
when compiling the other instance declarations)
In the second argument of `($)', namely `test a b'
In the expression: map Spec1 $ test a b
In the definition of `test':
test a (Spec1 b) = map Spec1 $ test a b
Failed, modules loaded: none.
}}}
After adding `IncoherentInstances` the file also goes through ghc-6 with
the same results.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7296>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list