           stacktrace = System.stacktrace
           io.error "** (#{inspect exception.__record__(:name)}) #{exception.message}"
           print_stacktrace io, stacktrace
-          config.cache('')
+          {config.cache(''), history}
       catch
         kind, error ->
           stacktrace = System.stacktrace
           io.error "** (#{kind}) #{inspect(error)}"
           print_stacktrace io, stacktrace
-          config.cache('')
+          {config.cache(''), history}
       end
 
-    do_loop(new_config)
+    do_loop(new_config, history)
   end
 
   defp print_stacktrace(io, stacktrace) do

    cache   = config.cache
    code    = cache ++ io.get(cache, counter)

    new_config =
      try do
        { result, new_binding, scope } =
          Erlang.elixir.eval(code, config.binding, counter, config.scope)
        io.put result
        config.binding(new_binding).cache('').scope(scope)
      rescue
        TokenMissingError ->
          config.cache(code)

  code cache, the instructions counter and needs to
  return a list with the new characters inserted.
  """
  def get(cache, count) do
    prompt = case cache do
      [] -> "iex(#{count})> "
      _ -> "...> "
    end
    :unicode.characters_to_list(IO.gets(prompt))
