   # TODO: should we support bare records?
   #   [a: 2 b: 3]
   form.tea = new Constrained (concatMap _constraints, elems),
-    applyKindFn (tupleType arity), (tea for {tea} in elems)...
+    applyKindFn (tupleType arity), (tea.type for {tea} in elems)...
 
   if ctx.assignTo()
     combinePatterns compiledElems

constraintsFromInstance = (ctx, constraint) ->
  {className, type} = constraint
  for instance in (ctx.classNamed className).instances
    substitution = match instance.type, constraint
    if not lookupInMap substitution, "could not unify"
      return map ((c) -> substitute substitution, c), instance.constraints
  null

    newMapWith variable.name, type

# Returns a substitution
matchType = (ctx, t1, t2) ->
  if t1 instanceof TypeVariable and kindsEq (kind t1), (kind t2)
    newMapWith t1.name, t2
  else if t1 instanceof TypeConstr and t2 instanceof TypeConstr and
    t1.name is t2.name
      emptySubstitution()
  else if t1 instanceof TypeApp and t2 instanceof TypeApp
    s1 = matchType t1.op, t2.op
    s2 = matchType t1.arg, t2.arg
    s3 = mergeSubs s1, s2
    s3 or
      newMapWith "could not unify", [(printType t1), (printType t2)]
