           ctx.allBoundTypeVariables(),
           (findFree currentType),
           (substituteList ctx.substitution, matched.tea.constraints)
-        # log "assign type", name, printType currentType
+        # log "assign type", name, (printType currentType), retainedConstraints
         ctx.assignType name,
           if ctx.isAtDeferrableDefinition()
             quantifyUnbound ctx, (addConstraints currentType, retainedConstraints)

      if ctx.isClassDefined name
        malformed 'class already defined', ctx.definitionPattern()
      else
        classConstraint = findClassType name, paramNames, declarations
        ctx.addClass name, classConstraint, superClasses, declarations
        declareMethods ctx, classConstraint, declarations

        translateDict name, (keysOfMap declarations), superClasses
    else
      'malformed'

findClassType = (className, paramNames, methods) ->
  kinds = mapMap (-> undefined), (arrayToSet paramNames)
  for name, {arity, type, def} of values methods
    for param in paramNames

      # TODO: defer for class declaration if not defined
      ## if not ctx.isClassDefined className    ...

      instance = (new Constrained freshConstraints,
        (new ClassConstraint instanceType.className, freshInstanceType.type))
      ## if overlaps ctx, instance
      ##   malformed 'instance overlaps with another', instance
      ## else
