I have two properties that a function foo must satisfy:
prop_1 :: [Int] -> Bool
prop_1 xs = foo xs id == xs
prop_2 :: [Int] -> (Int -> Int) -> (Int -> Int) -> Bool
prop_2 xs f g = foo (foo xs f) g == foo xs (g . f)
I am trying to check whether the above properties satisfy the following function using quickCheck:
foo :: [a] -> (a -> b) -> [b]
foo xs f = []
When I tried running quickCheck with prop_2 I get the following error:
quickCheck(prop_2)
<interactive>:18:1: error:
No instance for (Show (Int -> Int))
arising from a use of 'quickCheck'
(maybe you haven't applied a function to enough arguments?)
In the expression: quickCheck (prop_2)
In an equation for 'it': it = quickCheck (prop_2)
I am not sure why I am getting this error and how I can resolve it. Any insights are appreciated.
prop_2must beShowable, sinceQuickCheckshould be able to show with what parameters theprop_2was disproven.ShowFunctionsfor that.