   type.op and (typeEq type.op, zeroArrowType)
 
 findDocsFor = (moduleName, reference) ->
+  if found = findDeclarationFor moduleName, reference
+    {name} = reference
+    {arity, type, docs, source} = found
+    {name: name, rawType: type, docs, arity, source}
+
+findDeclarationFor = (moduleName, reference) ->
   {declared: {savedScopes}} = lookupCompiledModule moduleName
-  {ctx} = contextWithDependencies reverseModuleDependencies moduleName
   {name, scope} = reference
   while scope > 0 and not found
     savedScope = savedScopes[scope]
     break if not savedScope
     found = lookupInMap savedScope.definitions, name
     scope = savedScope.parent
-  found or= lookupInMap ctx._scope(), name # Top scope
-  if found
-    {arity, type, docs} = found
-    {name: name, rawType: type, docs, arity}
+  if not found
+    {ctx} = contextWithDependencies reverseModuleDependencies moduleName
+    found = lookupInMap ctx._scope(), name # Top scope
+  found
 
 # API
 

  assignArity: (name, arity) ->
    (@_declarationInCurrentScope name).arity = arity

  declareTyped: (names, types) ->
    for name, i in names
      @declare name, type: types[i]


  constraints = matched.tea.constraints
  # log "pattern compiel", definedNames, pattern

  for {name, id, type} in definedNames
    deps = ctx.deferredNames()

