[GHC] #7578: Instance selection regression from 7.4 to 7.6
GHC
cvs-ghc at haskell.org
Sun Jan 13 21:01:36 CET 2013
#7578: Instance selection regression from 7.4 to 7.6
-----------------------------+----------------------------------------------
Reporter: nomeata | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler (Type checker)
Version: 7.6.1 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Blockedby:
Blocking: | Related:
-----------------------------+----------------------------------------------
The following code (useless due to minification) works in GHC 7.4.1:
{{{
{-# LANGUAGE FlexibleInstances, UndecidableInstances, OverlappingInstances
#-}
class CollectArgs a where
randomEvaluate :: a -> ()
instance CollectArgs b => CollectArgs (a -> b) where
randomEvaluate f = randomEvaluate (f undefined)
where () = randomEvaluate (f undefined)
instance Show a => CollectArgs a where
randomEvaluate x = ()
}}}
In 7.6.2-rc1, I get this error message
{{{
test.hs:8:20:
Could not deduce (Show b) arising from a use of `randomEvaluate'
from the context (CollectArgs b)
bound by the instance declaration at test.hs:6:10-46
Possible fix:
add (Show b) to the context of the instance declaration
In the expression: randomEvaluate (f undefined)
In a pattern binding: () = randomEvaluate (f undefined)
In an equation for `randomEvaluate':
randomEvaluate f
= randomEvaluate (f undefined)
where
() = randomEvaluate (f undefined)
}}}
The error message goes away if I remove the {{{() = randomEvaluate (f
undefined)}}} binding, i.e. the first recursive use of
{{{randomEvaluate}}} works fine.
(This came up at http://stackoverflow.com/questions/14294802/evaluating-
function-at-random-arguments-using-quickcheck/14295179#14295179)
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7578>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list