title: How to quickCheck on custom ADT in PureScript?
body: <p>For using QuickCheck, I'm trying to implement the Arbitrary instance:</p>
  
  <pre><code>import Test.QuickCheck
  import Test.QuickCheck.Arbitrary (class Arbitrary, class Coarbitrary)
  
  data Arith = Lit Int | Add Arith Arith | Neg Arith
  
  derive instance arithEq :: Eq Arith
  
  instance arbitraryFoo :: Arbitrary Arith where
      arbitrary = arbLit &lt;|&gt; arbAdd &lt;|&gt; arbNeg where
          arbAdd = do
              a &lt;- arbitrary
              b &lt;- arbitrary
              pure $ Add a b
          arbNeg = do
              a &lt;- arbitrary
              pure $ Neg a
          arbLit = do
              x &lt;- arbitrary
              pure $ Lit x
  </code></pre>
  
  <p>But PureScript told me that</p>
  
  <pre><code>The value of arbitraryFoo is undefined here, so this reference is not allowed.
  </code></pre>
  
  <p>And when I change my code acroding to the guide from the error message:</p>
  
  <pre><code>import Test.QuickCheck
  import Test.QuickCheck.Arbitrary (class Arbitrary, class Coarbitrary)
  import Control.Lazy
  
  instance arbitraryFoo :: Arbitrary Arith where
      arbitrary = fix $ \arb -&gt; let
          arbAdd = do
              a &lt;- arb
              b &lt;- arb
              pure $ Add a b
          arbNeg = do
              a &lt;- arb
              pure $ Neg a
          arbLit = do
              x &lt;- arbitrary
              pure $ Lit x
          in arbLit &lt;|&gt; arbAdd &lt;|&gt; arbNeg
  </code></pre>
  
  <p>I still got some error:</p>
  
  <pre><code>RangeError: Maximum call stack size exceeded
  </code></pre>
  
  <p>So, how can I fix that? and why <code>Arbitrary</code> can not be derived automatically?</p>