     params: (map validIdentifier, allFieldNames)
     body: paramAssigns)
   accessors = fieldNames.map (name) ->
-    (jsAssignStatement (validIdentifier "#{dictName}-#{name}"), (jsFunction
+    (jsVarDeclaration (validIdentifier "#{dictName}-#{name}"), (jsFunction
       name: (validIdentifier name)
       params: ["dict"]
       body: [(jsReturn (jsAccess "dict", name))]))

  initialized = newMap()
  for key, val of set.values
    addToMap initialized, key, fn val
  initialized

mapSet =

    module = lookupCompiledModule moduleName
    {modules, ctx} = contextWithDependencies moduleName
    [expression] = _terms ast
    compilationFn = (topLevelExpressionInModule importsFor moduleDependencies moduleName)
    {js} = compileCtxAstToJs compilationFn, ctx, expression
    (finalizeTypes ctx, expression)
    js: library + immutable + (listOfLines map lookupJs, modules) + '\n;' + js
    ast: ast
    errors: checkTypes ctx

importsFor = (moduleSet) ->
  lookupDefinitions = (name) ->
    console.log name
    setToArray (lookupCompiledModule name).declared.definitions
  mapKeys lookupDefinitions, moduleSet

contextWithDependencies = (moduleName) ->
  toInject = moduleDependencies moduleName
  ctx: injectedContext toInject
  modules: setToArray toInject

moduleDependencies = (moduleName) ->
  concatSets (collectRequiresFor moduleName), (newSetWith moduleName)

# Primitive type checking for now
checkTypes = (ctx) ->
