     (applyKindFn (new TypeConstr dataName, dataKind), typeVars...))
   fieldTypes: (map ((types) -> substituteList freshingSub, types), fieldTypes)
 
+
+ms['record+'] = ms_record_export = (ctx, call) ->
+  (call_ (token_ 'export'), [(call_ (token_ 'record'), (_arguments call))])
+
 ms.record = ms_record = (ctx, call) ->
     args = _validArguments call
     hasName = requireName ctx, 'Name required to declare new record'

  # types: typeEnumaration ctx
  errors: errors

compileModuleWithDependencies = (moduleName = '@unnamed') ->
  js: library + immutable + (listOfLines map lookupJs, (setToArray runtimeDependencies moduleName))

compileExpression = (source, moduleName = '@unnamed') ->
  {js} = parsed = parseExpression source, moduleName
  extend parsed,
    (js:  library + immutable + (listOfLines map lookupJs, (setToArray runtimeDependencies moduleName)) + '\n;' + js)

parseTopLevel = (source, moduleName = '@unnamed') ->
  ast = (astFromSource "(#{source})", -1, -1)
  parseWith ast, ast, topLevel, moduleName, yes

parseExpression = (source, moduleName = '@unnamed') ->
  ast = (astFromSource "(#{source})", -1, -1)
  [expression] = _terms ast
  compilationFn = (topLevelExpressionInModule importsFor moduleDependencies moduleName)
  parseWith ast, expression, compilationFn, moduleName, no

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

        name = arg.symbol
        if ctx.isFinallyTyped name, ctx.currentScopeIndex()
          malformed ctx, arg, "#{name} already declared"
        else if not ctx.isCurrentlyDeclared name
          # TODO: this will not trigger if we define in current/other module
          malformed ctx, arg, "#{name} was not declared in #{moduleName}"
        else if not ctx.importable name
          malformed ctx, arg, "#{name} was not exported from #{moduleName}"
        else
          arg.id = ctx.currentDeclarationId name
          arg.imported =
