QuickCheck v1 を使用しています。以下は、以下のように定義された単純な prop_xxx です。
prop_foo :: (Num a) =>[a] -> Bool
prop_foo xs = (reverse.reverse) xs == id xs
これは GHCi で正しくテストできます:
ただし、次のような関数で呼び出しをラップしようとしたとき:
f :: IO ()
f = quickCheck prop_foo
エラーが報告されました:
Ambiguous type variable `a' in the constraints:
`Num a' arising from a use of `prop_foo' at Foo.hs:147:15-22
`Arbitrary a'
arising from a use of `quickCheck' at Foo.hs:147:4-22
Probable fix: add a type signature that fixes these type variable(s)
のようなものを提供しましょうか
instance Arbitrary Xxx where
arbitrary = ...
coarbitrary c = ...
どうもありがとう。
-- ラリー