{"action":"created","comment":{"url":"https://api.github.com/repos/beatrichartz/csv/pulls/comments/57511659","id":57511659,"diff_hunk":"@@ -61,120 +61,102 @@ defmodule CSV.Decoder do\n       [%{:x => \\\"a\\\", :y => \\\"b\\\"}, %{:x => \\\"c\\\", :y => \\\"d\\\"}]\n   \"\"\"\n \n-  def decode(stream, options \\\\ []) do\n-    { headers, stream } = options\n-                          |> Keyword.get(:headers, false)\n-                          |> get_headers(stream, options)\n-\n-    row_length = case headers do\n-      false -> stream |> get_row_length(options)\n-      _ -> headers |> Enum.count\n-    end\n-\n-    num_workers = options\n-                  |> Keyword.get(:num_workers, options\n-                  |> Keyword.get(:num_pipes, Defaults.num_workers))\n-\n-    multiline_escape = options\n-                        |> Keyword.get(:multiline_escape, true)\n+  def decode!(stream, options \\\\ []) do\n+    decode(stream, options)\n+    |> handle_errors!","path":"lib/csv/decoder.ex","position":22,"original_position":22,"commit_id":"5df02f14d6f765afe95d82a7d4bb0f66f699710b","original_commit_id":"5df02f14d6f765afe95d82a7d4bb0f66f699710b","user":{"login":"beatrichartz","id":305847,"avatar_url":"https://avatars.githubusercontent.com/u/305847?v=3","gravatar_id":"","url":"https://api.github.com/users/beatrichartz","html_url":"https://github.com/beatrichartz","followers_url":"https://api.github.com/users/beatrichartz/followers","following_url":"https://api.github.com/users/beatrichartz/following{/other_user}","gists_url":"https://api.github.com/users/beatrichartz/gists{/gist_id}","starred_url":"https://api.github.com/users/beatrichartz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beatrichartz/subscriptions","organizations_url":"https://api.github.com/users/beatrichartz/orgs","repos_url":"https://api.github.com/users/beatrichartz/repos","events_url":"https://api.github.com/users/beatrichartz/events{/privacy}","received_events_url":"https://api.github.com/users/beatrichartz/received_events","type":"User","site_admin":false},"body":"This is a nice use of composition to make the new API possible - maybe we want to rename `handle_errors!` to `raise_errors!` as well to make the intent more clear?","created_at":"2016-03-26T09:53:04Z","updated_at":"2016-03-26T09:53:04Z","html_url":"https://github.com/beatrichartz/csv/pull/33#discussion_r57511659","pull_request_url":"https://api.github.com/repos/beatrichartz/csv/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/beatrichartz/csv/pulls/comments/57511659"},"html":{"href":"https://github.com/beatrichartz/csv/pull/33#discussion_r57511659"},"pull_request":{"href":"https://api.github.com/repos/beatrichartz/csv/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/beatrichartz/csv/pulls/33","id":64194732,"html_url":"https://github.com/beatrichartz/csv/pull/33","diff_url":"https://github.com/beatrichartz/csv/pull/33.diff","patch_url":"https://github.com/beatrichartz/csv/pull/33.patch","issue_url":"https://api.github.com/repos/beatrichartz/csv/issues/33","number":33,"state":"open","locked":false,"title":"Make decode return errors in a tuple and decode! raise errors","user":{"login":"kiliancs","id":98786,"avatar_url":"https://avatars.githubusercontent.com/u/98786?v=3","gravatar_id":"","url":"https://api.github.com/users/kiliancs","html_url":"https://github.com/kiliancs","followers_url":"https://api.github.com/users/kiliancs/followers","following_url":"https://api.github.com/users/kiliancs/following{/other_user}","gists_url":"https://api.github.com/users/kiliancs/gists{/gist_id}","starred_url":"https://api.github.com/users/kiliancs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiliancs/subscriptions","organizations_url":"https://api.github.com/users/kiliancs/orgs","repos_url":"https://api.github.com/users/kiliancs/repos","events_url":"https://api.github.com/users/kiliancs/events{/privacy}","received_events_url":"https://api.github.com/users/kiliancs/received_events","type":"User","site_admin":false},"body":"Changes `decode` to return a stream of monads, and adds `decode!`, which behaves like `decode` used to (raise any occurring error, returning a stream of rows).\r\n\r\nThis is in order to resolve #28.\r\n\r\nI apologize if I went overboard when refactoring to adjust to the requirements.\r\n\r\nI'm particularly not happy with the `Enum.into(%{})` and `Enum.into([])` it uses to pass options around, but it seem to make all the other code more readable since the merging and reading syntax in a map is shorter and it allows us to pattern match. Any ideas are appreciated.","created_at":"2016-03-25T18:54:43Z","updated_at":"2016-03-26T09:53:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"28ce4f4f8c6aa2a9c8cef788fb9381e480c2d1d0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/beatrichartz/csv/pulls/33/commits","review_comments_url":"https://api.github.com/repos/beatrichartz/csv/pulls/33/comments","review_comment_url":"https://api.github.com/repos/beatrichartz/csv/pulls/comments{/number}","comments_url":"https://api.github.com/repos/beatrichartz/csv/issues/33/comments","statuses_url":"https://api.github.com/repos/beatrichartz/csv/statuses/5df02f14d6f765afe95d82a7d4bb0f66f699710b","head":{"label":"kiliancs:decode_emit_monads","ref":"decode_emit_monads","sha":"5df02f14d6f765afe95d82a7d4bb0f66f699710b","user":{"login":"kiliancs","id":98786,"avatar_url":"https://avatars.githubusercontent.com/u/98786?v=3","gravatar_id":"","url":"https://api.github.com/users/kiliancs","html_url":"https://github.com/kiliancs","followers_url":"https://api.github.com/users/kiliancs/followers","following_url":"https://api.github.com/users/kiliancs/following{/other_user}","gists_url":"https://api.github.com/users/kiliancs/gists{/gist_id}","starred_url":"https://api.github.com/users/kiliancs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiliancs/subscriptions","organizations_url":"https://api.github.com/users/kiliancs/orgs","repos_url":"https://api.github.com/users/kiliancs/repos","events_url":"https://api.github.com/users/kiliancs/events{/privacy}","received_events_url":"https://api.github.com/users/kiliancs/received_events","type":"User","site_admin":false},"repo":{"id":54601684,"name":"csv","full_name":"kiliancs/csv","owner":{"login":"kiliancs","id":98786,"avatar_url":"https://avatars.githubusercontent.com/u/98786?v=3","gravatar_id":"","url":"https://api.github.com/users/kiliancs","html_url":"https://github.com/kiliancs","followers_url":"https://api.github.com/users/kiliancs/followers","following_url":"https://api.github.com/users/kiliancs/following{/other_user}","gists_url":"https://api.github.com/users/kiliancs/gists{/gist_id}","starred_url":"https://api.github.com/users/kiliancs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiliancs/subscriptions","organizations_url":"https://api.github.com/users/kiliancs/orgs","repos_url":"https://api.github.com/users/kiliancs/repos","events_url":"https://api.github.com/users/kiliancs/events{/privacy}","received_events_url":"https://api.github.com/users/kiliancs/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kiliancs/csv","description":"CSV Decoding and Encoding for Elixir","fork":true,"url":"https://api.github.com/repos/kiliancs/csv","forks_url":"https://api.github.com/repos/kiliancs/csv/forks","keys_url":"https://api.github.com/repos/kiliancs/csv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kiliancs/csv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kiliancs/csv/teams","hooks_url":"https://api.github.com/repos/kiliancs/csv/hooks","issue_events_url":"https://api.github.com/repos/kiliancs/csv/issues/events{/number}","events_url":"https://api.github.com/repos/kiliancs/csv/events","assignees_url":"https://api.github.com/repos/kiliancs/csv/assignees{/user}","branches_url":"https://api.github.com/repos/kiliancs/csv/branches{/branch}","tags_url":"https://api.github.com/repos/kiliancs/csv/tags","blobs_url":"https://api.github.com/repos/kiliancs/csv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kiliancs/csv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kiliancs/csv/git/refs{/sha}","trees_url":"https://api.github.com/repos/kiliancs/csv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kiliancs/csv/statuses/{sha}","languages_url":"https://api.github.com/repos/kiliancs/csv/languages","stargazers_url":"https://api.github.com/repos/kiliancs/csv/stargazers","contributors_url":"https://api.github.com/repos/kiliancs/csv/contributors","subscribers_url":"https://api.github.com/repos/kiliancs/csv/subscribers","subscription_url":"https://api.github.com/repos/kiliancs/csv/subscription","commits_url":"https://api.github.com/repos/kiliancs/csv/commits{/sha}","git_commits_url":"https://api.github.com/repos/kiliancs/csv/git/commits{/sha}","comments_url":"https://api.github.com/repos/kiliancs/csv/comments{/number}","issue_comment_url":"https://api.github.com/repos/kiliancs/csv/issues/comments{/number}","contents_url":"https://api.github.com/repos/kiliancs/csv/contents/{+path}","compare_url":"https://api.github.com/repos/kiliancs/csv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kiliancs/csv/merges","archive_url":"https://api.github.com/repos/kiliancs/csv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kiliancs/csv/downloads","issues_url":"https://api.github.com/repos/kiliancs/csv/issues{/number}","pulls_url":"https://api.github.com/repos/kiliancs/csv/pulls{/number}","milestones_url":"https://api.github.com/repos/kiliancs/csv/milestones{/number}","notifications_url":"https://api.github.com/repos/kiliancs/csv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kiliancs/csv/labels{/name}","releases_url":"https://api.github.com/repos/kiliancs/csv/releases{/id}","deployments_url":"https://api.github.com/repos/kiliancs/csv/deployments","created_at":"2016-03-24T00:09:42Z","updated_at":"2016-03-24T00:09:43Z","pushed_at":"2016-03-25T18:57:38Z","git_url":"git://github.com/kiliancs/csv.git","ssh_url":"git@github.com:kiliancs/csv.git","clone_url":"https://github.com/kiliancs/csv.git","svn_url":"https://github.com/kiliancs/csv","homepage":"","size":115,"stargazers_count":0,"watchers_count":0,"language":"Elixir","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"beatrichartz:master","ref":"master","sha":"5baca563b05728956c4f576d5aa4d3d6d419910e","user":{"login":"beatrichartz","id":305847,"avatar_url":"https://avatars.githubusercontent.com/u/305847?v=3","gravatar_id":"","url":"https://api.github.com/users/beatrichartz","html_url":"https://github.com/beatrichartz","followers_url":"https://api.github.com/users/beatrichartz/followers","following_url":"https://api.github.com/users/beatrichartz/following{/other_user}","gists_url":"https://api.github.com/users/beatrichartz/gists{/gist_id}","starred_url":"https://api.github.com/users/beatrichartz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beatrichartz/subscriptions","organizations_url":"https://api.github.com/users/beatrichartz/orgs","repos_url":"https://api.github.com/users/beatrichartz/repos","events_url":"https://api.github.com/users/beatrichartz/events{/privacy}","received_events_url":"https://api.github.com/users/beatrichartz/received_events","type":"User","site_admin":false},"repo":{"id":31433548,"name":"csv","full_name":"beatrichartz/csv","owner":{"login":"beatrichartz","id":305847,"avatar_url":"https://avatars.githubusercontent.com/u/305847?v=3","gravatar_id":"","url":"https://api.github.com/users/beatrichartz","html_url":"https://github.com/beatrichartz","followers_url":"https://api.github.com/users/beatrichartz/followers","following_url":"https://api.github.com/users/beatrichartz/following{/other_user}","gists_url":"https://api.github.com/users/beatrichartz/gists{/gist_id}","starred_url":"https://api.github.com/users/beatrichartz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beatrichartz/subscriptions","organizations_url":"https://api.github.com/users/beatrichartz/orgs","repos_url":"https://api.github.com/users/beatrichartz/repos","events_url":"https://api.github.com/users/beatrichartz/events{/privacy}","received_events_url":"https://api.github.com/users/beatrichartz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/beatrichartz/csv","description":"CSV Decoding and Encoding for Elixir","fork":false,"url":"https://api.github.com/repos/beatrichartz/csv","forks_url":"https://api.github.com/repos/beatrichartz/csv/forks","keys_url":"https://api.github.com/repos/beatrichartz/csv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/beatrichartz/csv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/beatrichartz/csv/teams","hooks_url":"https://api.github.com/repos/beatrichartz/csv/hooks","issue_events_url":"https://api.github.com/repos/beatrichartz/csv/issues/events{/number}","events_url":"https://api.github.com/repos/beatrichartz/csv/events","assignees_url":"https://api.github.com/repos/beatrichartz/csv/assignees{/user}","branches_url":"https://api.github.com/repos/beatrichartz/csv/branches{/branch}","tags_url":"https://api.github.com/repos/beatrichartz/csv/tags","blobs_url":"https://api.github.com/repos/beatrichartz/csv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/beatrichartz/csv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/beatrichartz/csv/git/refs{/sha}","trees_url":"https://api.github.com/repos/beatrichartz/csv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/beatrichartz/csv/statuses/{sha}","languages_url":"https://api.github.com/repos/beatrichartz/csv/languages","stargazers_url":"https://api.github.com/repos/beatrichartz/csv/stargazers","contributors_url":"https://api.github.com/repos/beatrichartz/csv/contributors","subscribers_url":"https://api.github.com/repos/beatrichartz/csv/subscribers","subscription_url":"https://api.github.com/repos/beatrichartz/csv/subscription","commits_url":"https://api.github.com/repos/beatrichartz/csv/commits{/sha}","git_commits_url":"https://api.github.com/repos/beatrichartz/csv/git/commits{/sha}","comments_url":"https://api.github.com/repos/beatrichartz/csv/comments{/number}","issue_comment_url":"https://api.github.com/repos/beatrichartz/csv/issues/comments{/number}","contents_url":"https://api.github.com/repos/beatrichartz/csv/contents/{+path}","compare_url":"https://api.github.com/repos/beatrichartz/csv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/beatrichartz/csv/merges","archive_url":"https://api.github.com/repos/beatrichartz/csv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/beatrichartz/csv/downloads","issues_url":"https://api.github.com/repos/beatrichartz/csv/issues{/number}","pulls_url":"https://api.github.com/repos/beatrichartz/csv/pulls{/number}","milestones_url":"https://api.github.com/repos/beatrichartz/csv/milestones{/number}","notifications_url":"https://api.github.com/repos/beatrichartz/csv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/beatrichartz/csv/labels{/name}","releases_url":"https://api.github.com/repos/beatrichartz/csv/releases{/id}","deployments_url":"https://api.github.com/repos/beatrichartz/csv/deployments","created_at":"2015-02-27T18:39:55Z","updated_at":"2016-03-26T00:44:01Z","pushed_at":"2016-03-25T18:57:41Z","git_url":"git://github.com/beatrichartz/csv.git","ssh_url":"git@github.com:beatrichartz/csv.git","clone_url":"https://github.com/beatrichartz/csv.git","svn_url":"https://github.com/beatrichartz/csv","homepage":"","size":108,"stargazers_count":68,"watchers_count":68,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":3,"forks":15,"open_issues":3,"watchers":68,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/beatrichartz/csv/pulls/33"},"html":{"href":"https://github.com/beatrichartz/csv/pull/33"},"issue":{"href":"https://api.github.com/repos/beatrichartz/csv/issues/33"},"comments":{"href":"https://api.github.com/repos/beatrichartz/csv/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/beatrichartz/csv/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/beatrichartz/csv/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/beatrichartz/csv/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/beatrichartz/csv/statuses/5df02f14d6f765afe95d82a7d4bb0f66f699710b"}}}}