title: How to create instance of Read for a datatype in haskell
body: <p>So I have a data type </p>
  
  <pre><code>data SomeType a =
      Type a |
      Mix (SomeType a) (SomeType a)
  </code></pre>
  
  <p>This my show instance for SomeType  </p>
  
  <pre><code>instance (Show a) =&gt; Show (SomeType a) where
      show (Type a) = show a
      show (Mix a b) = "(" ++ show a ++ " " ++ show b ++ ")"
  </code></pre>
  
  <p>So  </p>
  
  <pre><code>Mix (Type 5) (Type 4)
  </code></pre>
  
  <p>would give me</p>
  
  <pre><code>(5 4)
  </code></pre>
  
  <p>Now I want to have  </p>
  
  <pre><code>read "(3 4)" :: SomeType Int 
  </code></pre>
  
  <p>produce </p>
  
  <pre><code>(3 4)
  </code></pre>
  
  <p>or  </p>
  
  <pre><code>read "(a b)" :: SomeType Char
  </code></pre>
  
  <p>produce  </p>
  
  <pre><code>(a b)
  </code></pre>
  
  <p>I am lost at how to use the Read class.</p>