title: Making an Arbitrary Instance for a newtype that uses Maybe
body: <p>I want to create an <code>Arbitrary</code> instance for the following newtype, in order to use it for QuickCheck:</p>
  
  <pre><code>newtype Wrapmaybe a = Wrapmaybe {getMaybe :: Maybe a} deriving (Eq, Show)
  </code></pre>
  
  <p>I know that the <code>Arbitrary</code> instance for <code>Maybe</code> can be written as follows:</p>
  
  <pre><code>instance Arbitrary a =&gt; Arbitrary (Maybe a) where
       arbitrary = frequency [(1, return Nothing), (1, liftM Just arbitrary)]
  </code></pre>
  
  <p>How do I write the <code>Arbitrary</code> instance for something like the following without getting a type error or kind error:</p>
  
  <pre><code>instance Arbitrary a =&gt; Arbitrary (Wrapmaybe Maybe a) where
     etc...
  </code></pre>