Skip to content

Regression: 8.4.1 says "Could not deduce" when before 8.4 it could

Have some code:

import           Test.QuickCheck
import           Test.QuickCheck.Monadic

testPropertyIO :: Testable a => PropertyM IO a -> Property
testPropertyIO = monadicIO . (=<<) stop

That compiles fine with ghc 7.10 through 8.2, but with 8.4.1 fails with:

test/Test/Mafia/IO.hs:18:18: error:
    ? Could not deduce (Testable a0) arising from a use of ?monadicIO?
      from the context: Testable a
        bound by the type signature for:
                   testPropertyIO :: forall a.
                                     Testable a =>
                                     PropertyM IO a -> Property
        at test/Test/Mafia/IO.hs:17:1-58
      The type variable ?a0? is ambiguous
      These potential instances exist:
        instance [safe] Testable prop => Testable (Gen prop)
          -- Defined in ?Test.QuickCheck.Property?
        instance [safe] Testable Discard
          -- Defined in ?Test.QuickCheck.Property?
        instance [safe] Testable Property
          -- Defined in ?Test.QuickCheck.Property?
        ...plus three others
        ...plus two instances involving out-of-scope types
        (use -fprint-potential-instances to see them all)
    ? In the first argument of ?(.)?, namely ?monadicIO?
      In the expression: monadicIO . (=<<) stop
      In an equation for ?testPropertyIO?:
          testPropertyIO = monadicIO . (=<<) stop

Either the compiler has been incorrectly accepting this as valid for a number of releases or this is a regression.

Trac metadata
Trac field Value
Version 8.4.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Edited by Ryan Scott
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information