I want to generate values, so that i have some arbitrary object, which has a certain set of signals, and each set of signals has a certain set of sensor value pairs, were the values are arbitrary.<br>However to demonstrate my problem I have an easy example, were I want to generate an instance of<br>
<br>data QCExample = QCExample Int Int<br> deriving Show<br><br>and the second value should always be the double of the first. So I tried this:<br><br>instance Arbitrary QCExample where<br> arbitrary = <br> let i1 = arbitrary<br>
i2 = fmap (* 2) i1<br> in liftM2 QCExample i1 i2 <br><br>but showing some of the generated test cases in ghci does not give me what I expected:<br><br>let gen :: Gen (QCExample) = arbitrary<br>Test.QuickCheck.Gen.sample gen<br>
<br>> QCExample (-2) 0<br>> QCExample (-4) (-6)<br>> QCExample 3 30<br>> ...<br>I know that I can filter, but this would be to inefficient.<br><br>Jürgen<br>