title: How to define a function with different types of input and output?
body: <p>I tried the following code:</p>
  
  <pre class="lang-haskell prettyprint-override"><code>data InputType = NumType Int Int | StrType String String
  data OutputType = Either Int String
  add' :: InputType -&gt; InputType -&gt; OutputType
  add' (NumType a b) = a + b
  add' (StrType a b) = a ++ b
  </code></pre>
  
  <p>But failed :(</p>