     # First get rid of instances of already resolved types
     unresolvedNames = newMap()
     for name, types of values names
-      if canonicalType = ctx.type name
+      if (canonicalType = ctx.type name) and canonicalType not instanceof TempType
         for type in types
           unify ctx, type.type, (freshInstance ctx, canonicalType).type
       else

  for {name, id, type} in definedNames
    currentType = substitute ctx.substitution, type
    deps = ctx.deferredNames()
    if deps.length > 0
      # log "adding top level lhs to deferred #{name}", deps
      ctx.addToDeferred {name, type, deps: (map (({name}) -> name), deps)}
      for dep in deps
        ctx.addToDeferred {name: dep.name, type: dep.type, deps: [name]}
      ctx.declare name, type: (new TempType type), id: id
    else
      # TODO: this is because functions might declare arity before being declared
      if not ctx.isCurrentlyDeclared name
        ctx.declare name, id: id
      # For explicitly typed bindings, we need to check that the inferred type
      #   corresponds to the annotated
      if ctx.isTyped name

  visitExpressions ast, (expression) ->
    expressions.push "#{collapse toHtml expression} :: #{highlightType expression.tea}" if expression.tea
  types: values mapMap (__ highlightType, _type), subtractMaps ctx._scope(), builtInDefinitions()
  subs: subToObject mapSub highlightType, ctx.substitution
  ast: expressions
  deferred: ctx.deferredBindings()

