     @_scope().deferredBindings.push binding
 
   addToDefinedNames: (binding) ->
-    @_definition().definedNames.push binding
+    @_currentDefinition()?.definedNames?.push binding
 
   definedNames: ->
-    @_definition().definedNames
+    @_currentDefinition()?.definedNames ? []
 
   deferredNames: ->
     @_definition().deferredBindings

      if ctx.isAtDefinition()
        #log "adding arity for #{ctx.definitionName()}", paramNames
        ctx.declareArity ctx.definitionName(), paramNames

      # log "inside #{ctx.definitionName()}", ctx.shouldDefer(), body.tea

      assignCompile ctx, call,
        if ctx.shouldDefer()

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

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