 freshName = (nameIndex) ->
   suffix = if nameIndex > 25 then nameIndex // 25 else ''
   String.fromCharCode 97 + nameIndex % 25
+
+ignoreTypeErrors = (fn) ->
+  try
+    ret = fn()
+  catch e
+    unless e instanceof TypeError
+      throw e
+
+class TypeError extends Error
+  # required for instanceof to work
+  constructor: (@message, @data) -> super @message
 
 # mycroft = (context, node, environment) ->
 #   if node.label is 'numerical'

        [s1, nextIndex, expression]

      # Call
      else if (Array.isArray expression) and expression.length > 2
        [op..., arg] = inside expression
        [s, nextIndex, tea] = inferCall context, [op, arg], nameIndex
        expression.tea = tea
        [s, nextIndex, expression]

inferCall = (context, pair, nameIndex) ->
  [ops, arg] = pair

        {params, body, wheres} = fnDefinition expression
        # TODO: more params
        definedParams = inside params
        if definedParams.length is 0
          throw new TypeError "Typing lambdas without a param not implemented yet"
        argName = freshName nameIndex
        param = definedParams[0]
        context = concatMaps context, newMapWith param.token, argName
