[Haskell-cafe] How to generate dependend values with QuickCheck

2010-08-25 Thread Jürgen Nicklisch-Franken
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. However to demonstrate my problem I have an easy example, were I want to generate an instance of

Re: [Haskell-cafe] How to generate dependend values with QuickCheck

2010-08-25 Thread John Millikin
You're generating two random values, where you probably want to just generate one and then calculate the second from it. Try this: instance Arbitrary QCExample where arbitrary = do i1 - arbitrary return (QCExample i1 (i1 * 2)) 2010/8/25 Jürgen Nicklisch-Franken j...@arcor.de:

Re: [Haskell-cafe] How to generate dependend values with QuickCheck

2010-08-25 Thread Edward Z. Yang
Excerpts from Jürgen Nicklisch-Franken's message of Wed Aug 25 23:32:51 -0400 2010: instance Arbitrary QCExample where arbitrary = let i1 = arbitrary i2 = fmap (* 2) i1 in liftM2 QCExample i1 i2 What's happening here is that you are evaluating the random

Re: [Haskell-cafe] How to generate dependend values with QuickCheck

2010-08-25 Thread Ivan Lazar Miljenovic
2010/8/26 Jürgen Nicklisch-Franken j...@arcor.de: 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. However to demonstrate my problem I have an

Re: [Haskell-cafe] How to generate dependend values with QuickCheck

2010-08-25 Thread Jürgen Nicklisch-Franken
Thank you all, (you are responding so quick that I consider to stop thinking myself in the future and just ask). Jürgen Am Donnerstag, den 26.08.2010, 00:02 -0400 schrieb Edward Z. Yang: Excerpts from Jürgen Nicklisch-Franken's message of Wed Aug 25 23:32:51 -0400 2010: instance Arbitrary

Re: [Haskell-cafe] How to generate dependend values with QuickCheck

2010-08-25 Thread Ivan Lazar Miljenovic
2010/8/26 Jürgen Nicklisch-Franken j...@arcor.de: Thank you all, (you are responding so quick that I consider to stop thinking myself in the future and just ask). No, no, don't stop thinking: if you stop thinking, how are you going to be able to instantly answer someone else's question? (You