       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
+        {classConstraint, freshedDeclarations} = findClassType ctx, name, paramNames, declarations
+        ctx.addClass name, classConstraint, superClasses, freshedDeclarations
+        declareMethods ctx, classConstraint, freshedDeclarations
+
+        translateDict name, (keysOfMap freshedDeclarations), superClasses
     else
       'malformed'
 
-findClassType = (className, paramNames, methods) ->
+findClassType = (ctx, className, paramNames, methods) ->
   kinds = mapMap (-> undefined), (arrayToSet paramNames)
   for name, {arity, type, def} of values methods
     for param in paramNames

    prefixedName = instancePrefix instanceName, name
    ctx.declareArity prefixedName, arity
    ctx.assignType prefixedName, quantifiedType
  freshInstanceType.constraints

prefixWithInstanceName = (definitionPairs, instanceName) ->
  for [lhs, rhs] in definitionPairs

        dataType
      paramLabels = (_labeled _terms params or []).map(_fst).map(_labelName)
      # log "Adding constructor #{constr.symbol}", constrType
      ctx.declare constr.symbol,
        type: quantifyUnbound ctx, toConstrained constrType
        arity: (paramLabels if params)
