     # or use the substitution instead of type below:
     mapMap (-> {name, type}), findFree substitute ctx.substitution, type)
 
-  #log "pattern compiel", definedNames
+  # log "pattern compiel", definedNames, pattern
   for {name, type} in definedNames
     currentType = substitute ctx.substitution, type
     deps = concat mapToArray intersectRight (findFree currentType), tempVars
+    # log "deciding whether to defer type", name, currentType, deps
     if deps.length > 0
       depsNames =  deps
-      #log "adding top level lhs to deferred #{name}"
+      # log "adding top level lhs to deferred #{name}"
       ctx.addToDeferred {name, type, deps: (map (({name}) -> name), deps)}
       for dep in deps
         ctx.addToDeferred {name: dep.name, type: dep.type, deps: [name]}

  else if type instanceof TypeApp
    (kind type.op).to
  else
    throw "Invalid type in kind"

kindsEq = (k1, k2) ->
  k1 is k2 or


  newLateScope: ->
    @newScope()
    @_definition().late = yes

  closeScope: ->
    @scopes.pop()

  isInsideLateScope: ->
    @_definition().late

  isInTopScope: ->
    @_scope().topLevel
