1
QuickCheck v1을 사용하고 있습니다.quickCheck prop_xxx를 실행하는 함수를 작성하는 방법은 무엇입니까?
f :: IO()
f = quickCheck prop_foo
이 올바르게 GHCi 테스트 할 수
prop_foo :: (Num a) =>[a] -> Bool
prop_foo xs = (reverse.reverse) xs == id xs
: 여기에 다음과 같이 정의 된 간단한 prop_xxx는 내가 좋아하는 기능에 전화를 포장하려 할 때 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)
내가 뭔가 사장님을 제공한다
그것은 오류를보고 e
instance Arbitrary Xxx where
arbitrary = ...
coarbitrary c = ...
고마워요.
- 래리
당신은 그것을 단형 유형 서명를 제공해야
정확하게,'ghci'의 기본값은'Integer'입니다. 그것이 ghci가 불평하지 않는 이유입니다. 물론 그것은 편의를위한 것입니다. 아니? – Tarrasch