나는 이진 검색 기능에 대한 테스트를 작성했습니다.메인에서 quickcheck을 사용하는 방법
module Tests where
import Data.List (sort)
import Test.QuickCheck
import BinarySearch (binarySearch)
prop_equals_elem x xs = (binarySearch x $ sort xs) == (x `elem` xs)
args = Args {replay = Nothing, maxSuccess = 200, maxDiscard=200, maxSize=200, chatty = False}
main = do
quickCheck (prop_equals_elem :: (Ord a) => a -> [a] -> Bool)
그것은 잘 작동 ghci에 quickCheck를 사용하지만 실행하려고하면 메인는 오류
Tests.hs:12:5:
Ambiguous type variable `a0' in the constraints:
(Arbitrary a0) arising from a use of `quickCheckWith'
at Tests.hs:12:5-18
(Show a0) arising from a use of `quickCheckWith'
at Tests.hs:12:5-18
(Ord a0) arising from an expression type signature
at Tests.hs:12:26-72
왜 메인에서 작동하지 않습니다을 제공하지만 ghci에서합니까?
http://hackage.haskell.org/package/test-framework – alternative