title: Generating a list of lists of Int with QuickCheck
body: <p>I'm working through <a href="http://book.realworldhaskell.org/read/" rel="nofollow noreferrer">Real World
  Haskell</a> one of the
  exercises of chapter 4 is to implement an <code>foldr</code> based version of
  <code>concat</code>. I thought this would be a great candidate for testing with
  QuickCheck since there is an existing implementation to validate my
  results. This however requires me to define an instance of the
  <code>Arbitrary</code> typeclass that can generate arbitrary <code>[[Int]]</code>. So far I have
  been unable to figure out how to do this. My first attempt was: </p>
  
  <pre><code>module FoldExcercises_Test
  where
  
  import Test.QuickCheck
  import Test.QuickCheck.Batch
  
  import FoldExcercises
  
  prop_concat xs = 
      concat xs == fconcat xs
      where types = xs ::[[Int]]
  
  
  options = TestOptions { no_of_tests = 200
                        , length_of_tests = 1
                        , debug_tests = True }
  
  allChecks = [ 
                run (prop_concat)
              ]
  
  main = do
    runTests "simple" options allChecks
  </code></pre>
  
  <p>This results in no tests being performed. Looking at various bits and
  pieces I guessed that an <code>Arbitrary</code> instance declaration was needed and
  added</p>
  
  <pre><code>    instance Arbitrary a =&gt; Arbitrary [[a]] where
      arbitrary = sized arb' 
          where arb' n = vector n (arbitrary :: Gen a)
  </code></pre>
  
  <p>This resulted in ghci complaining that my instance declaration was
  invalid and that adding -XFlexibleInstances might solve my problem.
  Adding the <code>{-# OPTIONS_GHC -XFlexibleInstances #-}</code> directive 
  results in a type mismatch and an overlapping instances warning.</p>
  
  <p>So my question is what's needed to make this work? I'm obviously new
  to Haskell and am not finding any resources that help me out.
  Any pointers are much appreciated.</p>
  
  <h1>Edit</h1>
  
  <p>It appears I was misguided by QuickCheck's output when in a test first manner <code>fconcat</code> is defined as   </p>
  
  <pre><code>fconcat = undefined  
  </code></pre>
  
  <p>Actually implementing the function correctly indeed gives the expected result. <strong>DOOP</strong>!</p>