   def at(enumerable, index, default \\ nil) do
     case fetch(enumerable, index) do
       {:ok, h} -> h
-      :error   -> default
+      :error -> default
     end
   end
 

      Enumerable.reduce(enumerable, {:cont, :first}, fn
        x, :first ->
          {:cont, {:acc, x}}
        x, {:acc, acc} ->
          {:cont, {:acc, fun.(x, acc)}}
      end) |> elem(1)

    case result do
      :first      -> raise Enum.EmptyError
      {:acc, acc} -> acc
    end
  end


  def fetch(enumerable, index) when is_integer(index) do
    module = Enumerable.impl_for!(enumerable)

    case module.count(enumerable) do
      {:error, module} ->
        fetch_enumerable(enumerable, index, module)

      {:ok, count} when count <= index ->
        :error

      {:ok, _count} ->
        fetch_enumerable(enumerable, index, module)
    end
