만 something -> Bool
동의 quickCheckResult 후 좀 예 패스임의로 생성 된 결과를 인쇄하는 방법은 무엇입니까?
[Colour] -> Bool
[컬러] 상기 브래킷의 기능이 무엇을 모방? 왜 Colour -> Bool
? quickCheckResult에 임의의 인스턴스를 전달하는 방법은 무엇입니까?
data Colour = Green | Blue
instance Arbitrary Colour where
arbitrary = oneof [return Green, return Blue]
main = quickCheckResult ((\s -> s == s) :: [Colour] -> Bool)
[업데이트] 내 목표는 인
prop :: Fun Fun Integer -> Bool
let prop (Fun _ f) (Fun _ g) = (g.f) x == (f.g) x
quickCheck prop
구문 분석 오류 (아마도 잘못된 들여 쓰기) (업데이트) QuickCheck.Function를 사용하는
import Test.QuickCheck.Function
import Test.QuickCheck.Gen
import Test.QuickCheck
import Test.QuickCheck.Function
import Test.QuickCheck.Arbitrary
import Test.QuickCheck.Property
import Test.QuickCheck.Test
prop1 f g x = (g.f) x == (f.g) x where types = [f, g] :: [Int->Int]
instance CoArbitrary ex where
coarbitrary f g = prop1 (variant 0 f) (variant 0 g)
main = quickCheck prop1
test5.hs:11:10:
Illegal instance declaration for `CoArbitrary ex'
(All instance types must be of the form (T a1 ... an)
where a1 ... an are *distinct type variables*,
and each type variable appears at most once in the instance head.
Use -XFlexibleInstances if you want to disable this.)
In the instance declaration for `CoArbitrary ex'
3.How를 실행할 수 있습니다 다음
누군가는 내가 같은 오류 –
에있는 것을 발견, 첫번째 CoArbitrary을 구현하기 위해 나에게 말했다. 최신 버전에서는 임의 유형과 coarbitrary가 다른 유형 클래스에 있습니다. 귀하는 임의 및 협동 조합을 시행 할 필요가 없습니다. 그 중 하나만 있으면 충분합니다. –
만 QuickCheck의 이전 버전에서 다시합시다 CoArbitrary가 임의 – nponeccop