title: Lifting into data constructor using record syntax?
body: <p>I have the following type:</p>
  
  <pre><code>data Person a = {name :: String, age :: Int, injury :: Injury a}
  
  data Injury a = Physical a | Mental a
  </code></pre>
  
  <p>I'm trying to create a function that lifts an injury into a instance of a person:</p>
  
  <pre><code>liftInjury :: Person a -&gt; Injury a -&gt; Person a
  liftInjury person inj = person {injury = int}
  
  class Hospital i where
    admit :: Person a  -&gt; i -&gt; Person a
  
  instance Hospital (Injury a) where
    admin person inj = liftInjury person inj -- ERROR
  </code></pre>
  
  <p>Error: </p>
  
  <pre><code>Couldn't match type ‘a’ with ‘a1’
    ‘a’ is a rigid type variable bound by
      the instance declaration
  </code></pre>
  
  <p>Is this being caused because the compiler doesn't know that <code>a</code> denied in <code>liftInjury</code> is the same as the <code>a</code> in <code>instance Hospital (Injury a) ...</code> ?</p>
  
  <p>What's the best solution for this? </p>