I'm trying to set up a series of tests for a simple tic tac toe program I've written in Haskell and I'm unable to get past my first test due to a strange error being thrown reading:
Tests.hs:11:61: error:
* Couldn't match expected type `Int' with actual type `IO Int'
* In the third argument of `assertEqual', namely
`(test_user_value x)'
In the first argument of `TestCase', namely
`(assertEqual "for (test_user_value 3)," f (test_user_value x))'
In the expression:
TestCase
(assertEqual "for (test_user_value 3)," f (test_user_value x))
|
11 | test1 = TestCase (assertEqual "for (test_user_value 3)," f (test_user_value x))
| ^^^^^^^^^^^^^^^^^
Failed, one module loaded.
The value 'x' is an int but Haskell is reading it as 'IO Int' which is wrong, as I've specified "x :: Int". The function being tested has already been specified as "test_user_value :: Int -> IO Int" so I'm unsure why it is interpreting the variable incorrectly. Any suggestions would be appreciated.