5

I am using the Leksah IDE 0.15.0.1 and I get a warning when compiling the example package: "name ... found in source file but was not in scope".

What is the meaning of this Warning ?

I googled for this text but found noting enlightening.

enter image description here

jhegedus
  • 20,244
  • 16
  • 99
  • 167
  • Does it matter if you make a function declaration just above `prop_hello`? Something like `prop_hello :: String -> Bool`. – TobiMcNamobi Jun 05 '15 at 08:39
  • Probably related: http://stackoverflow.com/questions/28358575/quickcheckall-always-return-true Or this might help: http://stackoverflow.com/questions/1694097/haskell-compiler-error-not-in-scope – TobiMcNamobi Jun 05 '15 at 08:46

1 Answers1

1

The problem probably lies within the lines

testMain = do
    allPass <- $quickCheckAll
    unless allPass exitFailure

According to the QuickCheck documentation, in order to utilize quickCheckAll, the IO action that performs $quickCheckAll must have return [] before its definition.

To use quickCheckAll, add a definition to your module along the lines of

return []
runTests = $quickCheckAll

and then execute runTests.

So applying it to your testMain definition, it would end up being

return []
testMain = do
    allPass <- $quickCheckAll
    unless allPass exitFailure

The documentation also provides an explanation for such need:

Note: the bizarre return [] in the example above is needed on GHC 7.8 and > later; without it, quickCheckAll will not be able to find any of the properties. For the curious, the return [] is a Template Haskell splice that makes GHC insert the empty list of declarations at that point in the program; GHC typechecks everything before the return [] before it starts on the rest of the module, which means that the later call to quickCheckAll can see everything that was defined before the return []. Yikes!

figurantpp
  • 61
  • 1
  • 3