title: Purescript row polymorphism. What is the correct syntax?
body: <p>Playing with a function based on an example in "Purescript by Example" ch 5 and am a bit stumped on how to declare polymorphic row types.</p>
  
  <p>The following compiles fine</p>
  
  <pre><code>type Student = {
                first :: String,
                last :: String,
                class :: String
              }
  
  type GymMember = {
                first :: String,
                last :: String,
                benchPressPB :: Int
              }
  
  daveG :: GymMember
  daveG = {
          first: "Dave",
          last: "Bro",
          benchPressPB: 300
      }
  
  philS :: Student
  philS = {
          first : "Dave",
          last : "Swat",
          class : "1A"
        }
  
   schoolRollName :: forall t15.
    { last :: String
    , first :: String
    | t15
    } -&gt; String
   schoolRollName rec = rec.last &lt;&gt; ", " &lt;&gt; rec.first
  
  firstAndSurname :: forall t82.
  { first :: String
  , last :: String
  | t82
  }
  -&gt; String
  firstAndSurname rec =  rec.first &lt;&gt; " " &lt;&gt; rec.last
  
  daveFandS :: String
  daveFandS = firstAndSurname daveG
  
  daveSR :: String
  daveSR = schoolRollName daveG
  
  philFandS :: String
  philFandS = firstAndSurname philS
  
  philSR :: String
  philSR = schoolRollName philS
  </code></pre>
  
  <p>But how do I remove the duplication in the type signatures of schoolRollName and firstAndSurname. </p>
  
  <p>I thought the following would work but the types do not match up:</p>
  
  <pre><code>type NamedThing = forall t15.
                  { last :: String
                  , first :: String
                  | t15
                  }
  
  schoolRollName :: NamedThing -&gt; String
  schoolRollName rec = rec.last &lt;&gt; ", " &lt;&gt; rec.first
  
  firstAndSurname :: NamedThing -&gt; String
  firstAndSurname rec =  rec.first &lt;&gt; " " &lt;&gt; rec.last
  
  -- !! Could not match type
  daveFandS :: String
  daveFandS = firstAndSurname daveG
  </code></pre>