title: How do I define a data type consisting of other data types?
body: <p>I want to define the data type Currency, which consists of three other data types. I have the problem that Haskell doesn't recognize the data types as a part of currency, which breaks everything.</p>
  
  <p>My idea was to define the different currencies as their own data types and then add them to the Currency type, which I tried with:</p>
  
  <pre class="lang-hs prettyprint-override"><code>data Euro = MkEuro Integer Integer
  data Dollar = MkDollar Integer Integer
  data Yen = MkYen Integer
  data Currency = Euro | Dollar | Yen
  </code></pre>
  
  <p>If I want to use the type Currency in any function I get a variation of the following error message:</p>
  
  <pre class="lang-hs prettyprint-override"><code>Couldn't match expected type `Currency' with actual type `Dollar'
  </code></pre>
  
  <p>Sadly I have to use the type Currency and can't create different functions for all three currencies.</p>