title: How can I constraint QuickCheck parameters, e.g. only use non-negative ints?
body: <p>I'm new to Haskell. It's very nice so far, but I'm running into copy-pasting for my QuickCheck properties, and I'd like to fix that.</p>
  
  <p>Here's a made-up example:</p>
  
  <pre><code>prop_Myfunc :: [Int] -&gt; (Int,Int) -&gt; Bool
  prop_Myfunc ints (i,j) = ints !! i == ints !! j
  </code></pre>
  
  <p>This won't work because QuickCheck generates negative numbers, so I get</p>
  
  <pre><code>*** Failed! (after 2 tests and 2 shrinks):                               
  Exception:
    Prelude.(!!): negative index
  </code></pre>
  
  <p>I've tried to google for solutions to this, and I've found e.g. <a href="http://hackage.haskell.org/package/QuickCheck-2.7.6/docs/Test-QuickCheck.html#t:NonNegative" rel="noreferrer">NonNegative</a> and ==>, but I don't understand how they work.</p>
  
  <p>How can I restrict the above example so that i and j are never negative? And also, so that neither is too high? That is: <code>0 &lt;= i,j &lt; length ints</code></p>