 
       iex> File.stream!(\"data.csv\") |>
       iex> CSV.Decoder.decode |>
-      iex> Enum.take(2)
-      [[\"a\",\"b\",\"c\"], [\"d\",\"e\",\"f\"]]
-
-  Convert a filestream into a stream of rows in order of the given stream:
-
-      iex> File.stream!(\"data.csv\") |>
-      iex> CSV.Decoder.decode(num_pipes: 1) |>
       iex> Enum.take(2)
       [[\"a\",\"b\",\"c\"], [\"d\",\"e\",\"f\"]]
 

    * `:delimiter`   – The delimiter token to use, defaults to `\r\n`. Must be a string.
    * `:strip_cells` – When set to true, will strip whitespace from cells. Defaults to false.
    * `:num_pipes`   – The number of parallel operations to run when producing the stream.
      If set to 1, the stream will produce the CSV lines in order at the
      cost of performance. Defaults to `8`.
    * `:headers`     – When set to `true`, will take the first row of the csv and use it as
      header values.
      When set to a list, will use the given list as header values.

  end

  defp build_consumer!(stream, headers) do
    Stream.transform stream, 0, fn items, acc ->
      mapped = items |> Enum.map fn { relay, index } ->
        relay |> send :next
        receive do
          { ^relay, { :row, { ^index, row } } } ->
            build_row(row, headers)
          { ^relay, { :syntax_error, { index, message } } } ->
            raise Parser.SyntaxError, line: index, message: message
          { ^relay, { :lexer_error, { index, message } } } ->
            raise Lexer.EncodingError, line: index, message: message
        end
      end

      { mapped, acc + 1 }
    end
  end

