     toInject = collectRequiresFor moduleName
     ctx = injectedContext toInject
     {js, ast} = compileCtxAstToJs topLevel, ctx, (astFromSource "(#{source})", -1, -1)
-    checkTypes ctx
     replaceOrAddToMap compiledModules, moduleName,
       declared: (subtractContexts ctx, (injectedContext toInject)) # must recompute because ctx is mutated
       js: js
     (attachPrintedTypes ctx, ast)
-    {js, ast: ast, types: typeEnumaration ctx}
+    js: js
+    ast: ast
+    types: typeEnumaration ctx
+    errors: checkTypes ctx
 
 compileExpression = (source, moduleName = '@unnamed') ->
   module = lookupInMap compiledModules, moduleName

  ast = (astFromSource "(#{source})", -1, -1)
  [expression] = _terms ast
  {js} = compileCtxAstToJs topLevelExpression, ctx, expression
  checkTypes ctx
  (attachPrintedTypes ctx, expression)
  js: library + immutable + (listOfLines map lookupJs, setToArray toInject) + js
  ast: ast

# Primitive type checking for now
checkTypes = (ctx) ->
  # failed = mapToArray filterMap ((name) -> name is 'could not unify'), ctx.substitution
  if _notEmpty (failed = ctx.substitution.fails)
    throw new Error failed[0]

lookupJs = (moduleName) ->
  js = (lookupInMap compiledModules, moduleName)?.js

    labels.length is values.length and (allMap isLabel, labels)

isSeq = (expression) ->
  (isForm expression) and expression[0].symbol is '{'

isTuple = (expression) ->
  (isForm expression) and expression[0].symbol is '['

isEmptyForm = (form) ->
  (_terms form).length > 0
