Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to print generated result from arbitrary?
    text
    copied!<p>quickCheckResult only accept <code>something -&gt; Bool</code>, then i mimic some example, pass </p> <pre><code>[Colour] -&gt; Bool </code></pre> <p>what is function of the bracket of [Colour]? why not <code>Colour -&gt; Bool</code>? How to pass Arbitrary instance to quickCheckResult?</p> <pre><code>data Colour = Green | Blue instance Arbitrary Colour where arbitrary = oneof [return Green, return Blue] main = quickCheckResult ((\s -&gt; s == s) :: [Colour] -&gt; Bool) </code></pre> <p>[Updated] My goal is the following can run</p> <pre><code>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-&gt;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' </code></pre> <p>3.How to use QuickCheck.Function (Updated)</p> <pre><code>prop :: Fun Fun Integer -&gt; Bool let prop (Fun _ f) (Fun _ g) = (g.f) x == (f.g) x quickCheck prop </code></pre> <p>parse error (possibly incorrect indentation)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload