   if hasName
     macroName = ctx.definitionName()
 
-    compiledMacro = translateToJs translateIr ctx,
-        (termCompile ctx, call_ (token_ 'fn'), (join [paramTuple], rest))
+    macroSource = call_ (token_ 'fn'), (join [paramTuple], rest)
+    macroCompiled = (termCompile ctx, macroSource)
+    compiledMacro = translateToJs translateIr ctx, macroCompiled
+    retrieve call, macroSource
     macroFn = eval compiledMacro
     if macroFn
       ctx.declareMacro ctx.definitionPattern(), (ctx, call) ->
         constantToSource macroFn (_arguments call)...
+    else
+      malformed ctx, ctx.definitionPattern(), 'Macro failed to compile'
 
   jsNoop()
 

          [[(validIdentifier symbol), exp]]
  else
    # Name typed, use a fresh instance
    # log symbol, contextType
    if contextType and contextType not instanceof TempType
      type = freshInstance ctx, contextType
      nameTranslate ctx, atom, symbol, type
    # In sub-scope (function) only defer compilation for declarations in current scope
    else if (not ctx.isCurrentlyDeclared symbol) and
        (ctx.isFinallyDeclared symbol) or contextType instanceof TempType
      # Typing deferred, use an impricise type var
      type = toConstrained ctx.freshTypeVariable star
      ctx.addToDeferredNames {name: symbol, type: type}


  'pattern match syntax'
  """
  + (macro [x y]
    (: (Fn Num Num Num))
    (Js.binary "+" x y))

  infix (syntax [exp]
    (match exp
      (` ((, x) (, op) (, z))) (` ((, op) (, x) (, z)))
