title: Haskell - Combining datatypes?
body: <p>I'm new to Haskell, I've looked around for an answer to the below but had no luck.</p>
  
  <p>Why doesn't this code compile?</p>
  
  <pre><code>newtype Name = Name String deriving (Show, Read)
  newtype Age = Age Int deriving (Show, Read)
  newtype Height = Height Int deriving (Show, Read)
  
  data User = Person Name Age Height deriving (Show, Read)
  
  data Characteristics a b c = Characteristics a b c
  
  exampleFunction :: Characteristics a b c -&gt; User
  exampleFunction (Characteristics a b c) = (Person (Name a) (Age b) (Height c))
  </code></pre>
  
  <p>Error: </p>
  
  <pre><code>"Couldn't match expected type ‘String’ with actual type ‘a’,‘a’ is a rigid type, variable bound by the type signature"
  </code></pre>
  
  <p>However, this compiles just fine:</p>
  
  <pre><code>exampleFunction :: String -&gt; Int -&gt; Int -&gt; User
  exampleFunction a b c = (Person (Name a) (Age b) (Height c))
  </code></pre>
  
  <p>I realize there's simpler ways of doing the above, but I'm just testing the different uses of custom data types.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>My inclination is that the compiler doesn't like 'exampleFunction ::Characteristics  a b c' because its not type safe. i.e. I'm providing no guarantee of: a == Name String, b == Age Int, c == Height Int.</p>