       throw new Error "Macro #{name} already defined"
     else
       addToMap topScope.macros, name, macro
-  for name, {type, arity, docs, source, isClass, virtual, final} of values definitions when shouldImport name
+  for name, {type, arity, docs, source, isClass, virtual, final, exported} of values definitions when shouldImport name
     addToMap topScope, name, {
-      arity, docs, source, isClass, virtual, final,
+      arity, docs, source, isClass, virtual, final, exported,
       type: (type if shouldDeclare)
       tempType: type
       id: ctx.freshId()}

  isInTopScope: ->
    @_scope().topLevel

  exportName: (name) ->
    addToSet @_scope().exportedNames, name

  addTypeName: (dataType) ->
    if dataType instanceof TypeApp

  # types: typeEnumaration ctx
  errors: errors

compileModuleWithDependencies = (typedModulePath = defaultTypedModulePath) ->
  js: library + immutable + (listOfLines map lookupJs,
    (setToArray runtimeDependencies (modulePathToName typedModulePath.names)))

compileExpression = (source, typedModulePath = defaultTypedModulePath) ->
  {js} = parsed = parseExpression source, typedModulePath
  extend parsed,
    (js:  library + immutable + (listOfLines map lookupJs,
      (setToArray runtimeDependencies (modulePathToName typedModulePath.names))) + '\n;' + js)

parseTopLevel = (source, typedModulePath = defaultTypedModulePath) ->
  ast = (astFromSource "(#{source})", -1, -1)
  parseWith ast, ast, topLevel, typedModulePath, yes

parseExpression = (source, typedModulePath = defaultTypedModulePath) ->
  ast = (astFromSource "(#{source})", -1, -1)
  [expression] = _terms ast
  compilationFn = (topLevelExpressionInModule importsFor moduleDependencies (modulePathToName typedModulePath.names))
  parseWith ast, expression, compilationFn, typedModulePath, no

parseWith = (originalAst, ast, compilationFn, typedModulePath, doDeclare) ->
  if _empty _validTerms originalAst
    {
      ast: originalAst
      js: ''
    }
  else
    moduleName = modulePathToName typedModulePath.names
    {modules, ctx} = contextWithDependencies moduleDependencies moduleName
    ctx.typedModulePath = typedModulePath
    {js} = compileCtxAstToJs compilationFn, ctx, ast
    errors = checkTypes ctx
    (finalizeTypes ctx, ast)
