{"action":"created","comment":{"url":"https://api.github.com/repos/yesodweb/yesod/pulls/comments/181974653","pull_request_review_id":112692025,"id":181974653,"diff_hunk":"@@ -1360,6 +1361,16 @@ rawRequestBody = do\n fileSource :: MonadResource m => FileInfo -> ConduitT () S.ByteString m ()\n fileSource = transPipe liftResourceT . fileSourceRaw\n \n+-- | Strict `ByteString` body from `FileInfo`.\n+-- This function blocking while read file.\n+--\n+-- > do\n+-- >     fileByteString <- fileSourceByteString fileInfo\n+--\n+-- @since 1.6.4\n+fileSourceByteString :: MonadResource m => FileInfo -> m S.ByteString\n+fileSourceByteString fileInfo = fileSource fileInfo `connect` CL.foldMap id","path":"yesod-core/Yesod/Core/Handler.hs","position":29,"original_position":29,"commit_id":"955b21d7ea3c2166a139631a58656b0bd89d511b","original_commit_id":"955b21d7ea3c2166a139631a58656b0bd89d511b","user":{"login":"snoyberg","id":49415,"avatar_url":"https://avatars3.githubusercontent.com/u/49415?v=4","gravatar_id":"","url":"https://api.github.com/users/snoyberg","html_url":"https://github.com/snoyberg","followers_url":"https://api.github.com/users/snoyberg/followers","following_url":"https://api.github.com/users/snoyberg/following{/other_user}","gists_url":"https://api.github.com/users/snoyberg/gists{/gist_id}","starred_url":"https://api.github.com/users/snoyberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snoyberg/subscriptions","organizations_url":"https://api.github.com/users/snoyberg/orgs","repos_url":"https://api.github.com/users/snoyberg/repos","events_url":"https://api.github.com/users/snoyberg/events{/privacy}","received_events_url":"https://api.github.com/users/snoyberg/received_events","type":"User","site_admin":false},"body":"There are a few problems with this implementation:\r\n\r\n1. `CL.foldMap id` has quadratic complexity. It would be better to use something like [`sinkLazy`](https://www.stackage.org/haddock/lts-11.5/conduit-1.3.0.2/Conduit.html#v:sinkLazy)\r\n2. It's more common to use `runConduit $ src .| sink`\r\n\r\nHow about:\r\n\r\n```haskell\r\nrunConduit $ fileSource fileInfo .| Conduit.","created_at":"2018-04-17T07:26:42Z","updated_at":"2018-04-17T07:27:31Z","html_url":"https://github.com/yesodweb/yesod/pull/1503#discussion_r181974653","pull_request_url":"https://api.github.com/repos/yesodweb/yesod/pulls/1503","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/yesodweb/yesod/pulls/comments/181974653"},"html":{"href":"https://github.com/yesodweb/yesod/pull/1503#discussion_r181974653"},"pull_request":{"href":"https://api.github.com/repos/yesodweb/yesod/pulls/1503"}}},"pull_request":{"url":"https://api.github.com/repos/yesodweb/yesod/pulls/1503","id":182054265,"html_url":"https://github.com/yesodweb/yesod/pull/1503","diff_url":"https://github.com/yesodweb/yesod/pull/1503.diff","patch_url":"https://github.com/yesodweb/yesod/pull/1503.patch","issue_url":"https://api.github.com/repos/yesodweb/yesod/issues/1503","number":1503,"state":"open","locked":false,"title":"added: fileSourceByteString","user":{"login":"ncaq","id":2913112,"avatar_url":"https://avatars1.githubusercontent.com/u/2913112?v=4","gravatar_id":"","url":"https://api.github.com/users/ncaq","html_url":"https://github.com/ncaq","followers_url":"https://api.github.com/users/ncaq/followers","following_url":"https://api.github.com/users/ncaq/following{/other_user}","gists_url":"https://api.github.com/users/ncaq/gists{/gist_id}","starred_url":"https://api.github.com/users/ncaq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncaq/subscriptions","organizations_url":"https://api.github.com/users/ncaq/orgs","repos_url":"https://api.github.com/users/ncaq/repos","events_url":"https://api.github.com/users/ncaq/events{/privacy}","received_events_url":"https://api.github.com/users/ncaq/received_events","type":"User","site_admin":false},"body":"This function is to get `FileInfo` raw body.\r\n\r\nConduit type is hard for begginer user.\r\n* [haskell - Persisting an uploaded file in the database (Couldn't match type ‘ConduitM () ByteString (ResourceT IO) ()’ with ‘HandlerT App IO ByteString’) - Stack Overflow](https://stackoverflow.com/questions/34969335/persisting-an-uploaded-file-in-the-database-couldnt-match-type-conduitm-by)\r\n* [Processing an uploaded file with and embedding it in a template - Google グループ](https://groups.google.com/forum/?hl=ja#!searchin/yesodweb/fileSource|sort:date/yesodweb/zeC_ZzDeg6E/EkXVISTdhAIJ)\r\n\r\nActually I was not sure when I was a Haskell beginner.\r\n\r\nByteString raw body of `FileInfo` is need to upload file to S3.\r\nThis function running our product.\r\nI send it to upstream.\r\n\r\nBefore submitting your PR, check that you've:\r\n\r\n- [x] Bumped the version number\r\n- [x] Documented new APIs with [Haddock markup](https://www.haskell.org/haddock/doc/html/index.html)\r\n- [x] Added [`@since` declarations](http://haskell-haddock.readthedocs.io/en/latest/markup.html#since) to the Haddocks for new, public APIs\r\n\r\nAfter submitting your PR:\r\n\r\n- [x] Update the Changelog.md file with a link to your PR\r\n- [ ] Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)\r\n\r\n<!---Thanks so much for contributing! :)\r\n\r\n_If these checkboxes don't apply to your PR, you can delete them_-->\r\n","created_at":"2018-04-17T05:21:59Z","updated_at":"2018-04-17T07:27:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb56c63acebf95f6117e242fece2e677cc4c5670","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/yesodweb/yesod/pulls/1503/commits","review_comments_url":"https://api.github.com/repos/yesodweb/yesod/pulls/1503/comments","review_comment_url":"https://api.github.com/repos/yesodweb/yesod/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yesodweb/yesod/issues/1503/comments","statuses_url":"https://api.github.com/repos/yesodweb/yesod/statuses/955b21d7ea3c2166a139631a58656b0bd89d511b","head":{"label":"ncaq:add-file-source-bytes","ref":"add-file-source-bytes","sha":"955b21d7ea3c2166a139631a58656b0bd89d511b","user":{"login":"ncaq","id":2913112,"avatar_url":"https://avatars1.githubusercontent.com/u/2913112?v=4","gravatar_id":"","url":"https://api.github.com/users/ncaq","html_url":"https://github.com/ncaq","followers_url":"https://api.github.com/users/ncaq/followers","following_url":"https://api.github.com/users/ncaq/following{/other_user}","gists_url":"https://api.github.com/users/ncaq/gists{/gist_id}","starred_url":"https://api.github.com/users/ncaq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncaq/subscriptions","organizations_url":"https://api.github.com/users/ncaq/orgs","repos_url":"https://api.github.com/users/ncaq/repos","events_url":"https://api.github.com/users/ncaq/events{/privacy}","received_events_url":"https://api.github.com/users/ncaq/received_events","type":"User","site_admin":false},"repo":{"id":95059451,"name":"yesod","full_name":"ncaq/yesod","owner":{"login":"ncaq","id":2913112,"avatar_url":"https://avatars1.githubusercontent.com/u/2913112?v=4","gravatar_id":"","url":"https://api.github.com/users/ncaq","html_url":"https://github.com/ncaq","followers_url":"https://api.github.com/users/ncaq/followers","following_url":"https://api.github.com/users/ncaq/following{/other_user}","gists_url":"https://api.github.com/users/ncaq/gists{/gist_id}","starred_url":"https://api.github.com/users/ncaq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncaq/subscriptions","organizations_url":"https://api.github.com/users/ncaq/orgs","repos_url":"https://api.github.com/users/ncaq/repos","events_url":"https://api.github.com/users/ncaq/events{/privacy}","received_events_url":"https://api.github.com/users/ncaq/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ncaq/yesod","description":"A RESTful Haskell web framework built on WAI.","fork":true,"url":"https://api.github.com/repos/ncaq/yesod","forks_url":"https://api.github.com/repos/ncaq/yesod/forks","keys_url":"https://api.github.com/repos/ncaq/yesod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ncaq/yesod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ncaq/yesod/teams","hooks_url":"https://api.github.com/repos/ncaq/yesod/hooks","issue_events_url":"https://api.github.com/repos/ncaq/yesod/issues/events{/number}","events_url":"https://api.github.com/repos/ncaq/yesod/events","assignees_url":"https://api.github.com/repos/ncaq/yesod/assignees{/user}","branches_url":"https://api.github.com/repos/ncaq/yesod/branches{/branch}","tags_url":"https://api.github.com/repos/ncaq/yesod/tags","blobs_url":"https://api.github.com/repos/ncaq/yesod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ncaq/yesod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ncaq/yesod/git/refs{/sha}","trees_url":"https://api.github.com/repos/ncaq/yesod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ncaq/yesod/statuses/{sha}","languages_url":"https://api.github.com/repos/ncaq/yesod/languages","stargazers_url":"https://api.github.com/repos/ncaq/yesod/stargazers","contributors_url":"https://api.github.com/repos/ncaq/yesod/contributors","subscribers_url":"https://api.github.com/repos/ncaq/yesod/subscribers","subscription_url":"https://api.github.com/repos/ncaq/yesod/subscription","commits_url":"https://api.github.com/repos/ncaq/yesod/commits{/sha}","git_commits_url":"https://api.github.com/repos/ncaq/yesod/git/commits{/sha}","comments_url":"https://api.github.com/repos/ncaq/yesod/comments{/number}","issue_comment_url":"https://api.github.com/repos/ncaq/yesod/issues/comments{/number}","contents_url":"https://api.github.com/repos/ncaq/yesod/contents/{+path}","compare_url":"https://api.github.com/repos/ncaq/yesod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ncaq/yesod/merges","archive_url":"https://api.github.com/repos/ncaq/yesod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ncaq/yesod/downloads","issues_url":"https://api.github.com/repos/ncaq/yesod/issues{/number}","pulls_url":"https://api.github.com/repos/ncaq/yesod/pulls{/number}","milestones_url":"https://api.github.com/repos/ncaq/yesod/milestones{/number}","notifications_url":"https://api.github.com/repos/ncaq/yesod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ncaq/yesod/labels{/name}","releases_url":"https://api.github.com/repos/ncaq/yesod/releases{/id}","deployments_url":"https://api.github.com/repos/ncaq/yesod/deployments","created_at":"2017-06-22T00:53:18Z","updated_at":"2018-04-17T04:22:39Z","pushed_at":"2018-04-17T07:23:46Z","git_url":"git://github.com/ncaq/yesod.git","ssh_url":"git@github.com:ncaq/yesod.git","clone_url":"https://github.com/ncaq/yesod.git","svn_url":"https://github.com/ncaq/yesod","homepage":"http://www.yesodweb.com/","size":8071,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yesodweb:master","ref":"master","sha":"06e0ffb48b14f56011f1c249636126386f16a026","user":{"login":"yesodweb","id":930379,"avatar_url":"https://avatars0.githubusercontent.com/u/930379?v=4","gravatar_id":"","url":"https://api.github.com/users/yesodweb","html_url":"https://github.com/yesodweb","followers_url":"https://api.github.com/users/yesodweb/followers","following_url":"https://api.github.com/users/yesodweb/following{/other_user}","gists_url":"https://api.github.com/users/yesodweb/gists{/gist_id}","starred_url":"https://api.github.com/users/yesodweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yesodweb/subscriptions","organizations_url":"https://api.github.com/users/yesodweb/orgs","repos_url":"https://api.github.com/users/yesodweb/repos","events_url":"https://api.github.com/users/yesodweb/events{/privacy}","received_events_url":"https://api.github.com/users/yesodweb/received_events","type":"Organization","site_admin":false},"repo":{"id":237904,"name":"yesod","full_name":"yesodweb/yesod","owner":{"login":"yesodweb","id":930379,"avatar_url":"https://avatars0.githubusercontent.com/u/930379?v=4","gravatar_id":"","url":"https://api.github.com/users/yesodweb","html_url":"https://github.com/yesodweb","followers_url":"https://api.github.com/users/yesodweb/followers","following_url":"https://api.github.com/users/yesodweb/following{/other_user}","gists_url":"https://api.github.com/users/yesodweb/gists{/gist_id}","starred_url":"https://api.github.com/users/yesodweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yesodweb/subscriptions","organizations_url":"https://api.github.com/users/yesodweb/orgs","repos_url":"https://api.github.com/users/yesodweb/repos","events_url":"https://api.github.com/users/yesodweb/events{/privacy}","received_events_url":"https://api.github.com/users/yesodweb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yesodweb/yesod","description":"A RESTful Haskell web framework built on WAI.","fork":false,"url":"https://api.github.com/repos/yesodweb/yesod","forks_url":"https://api.github.com/repos/yesodweb/yesod/forks","keys_url":"https://api.github.com/repos/yesodweb/yesod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yesodweb/yesod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yesodweb/yesod/teams","hooks_url":"https://api.github.com/repos/yesodweb/yesod/hooks","issue_events_url":"https://api.github.com/repos/yesodweb/yesod/issues/events{/number}","events_url":"https://api.github.com/repos/yesodweb/yesod/events","assignees_url":"https://api.github.com/repos/yesodweb/yesod/assignees{/user}","branches_url":"https://api.github.com/repos/yesodweb/yesod/branches{/branch}","tags_url":"https://api.github.com/repos/yesodweb/yesod/tags","blobs_url":"https://api.github.com/repos/yesodweb/yesod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yesodweb/yesod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yesodweb/yesod/git/refs{/sha}","trees_url":"https://api.github.com/repos/yesodweb/yesod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yesodweb/yesod/statuses/{sha}","languages_url":"https://api.github.com/repos/yesodweb/yesod/languages","stargazers_url":"https://api.github.com/repos/yesodweb/yesod/stargazers","contributors_url":"https://api.github.com/repos/yesodweb/yesod/contributors","subscribers_url":"https://api.github.com/repos/yesodweb/yesod/subscribers","subscription_url":"https://api.github.com/repos/yesodweb/yesod/subscription","commits_url":"https://api.github.com/repos/yesodweb/yesod/commits{/sha}","git_commits_url":"https://api.github.com/repos/yesodweb/yesod/git/commits{/sha}","comments_url":"https://api.github.com/repos/yesodweb/yesod/comments{/number}","issue_comment_url":"https://api.github.com/repos/yesodweb/yesod/issues/comments{/number}","contents_url":"https://api.github.com/repos/yesodweb/yesod/contents/{+path}","compare_url":"https://api.github.com/repos/yesodweb/yesod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yesodweb/yesod/merges","archive_url":"https://api.github.com/repos/yesodweb/yesod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yesodweb/yesod/downloads","issues_url":"https://api.github.com/repos/yesodweb/yesod/issues{/number}","pulls_url":"https://api.github.com/repos/yesodweb/yesod/pulls{/number}","milestones_url":"https://api.github.com/repos/yesodweb/yesod/milestones{/number}","notifications_url":"https://api.github.com/repos/yesodweb/yesod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yesodweb/yesod/labels{/name}","releases_url":"https://api.github.com/repos/yesodweb/yesod/releases{/id}","deployments_url":"https://api.github.com/repos/yesodweb/yesod/deployments","created_at":"2009-06-27T22:54:51Z","updated_at":"2018-04-16T10:56:17Z","pushed_at":"2018-04-17T07:24:10Z","git_url":"git://github.com/yesodweb/yesod.git","ssh_url":"git@github.com:yesodweb/yesod.git","clone_url":"https://github.com/yesodweb/yesod.git","svn_url":"https://github.com/yesodweb/yesod","homepage":"http://www.yesodweb.com/","size":8115,"stargazers_count":1911,"watchers_count":1911,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":313,"mirror_url":null,"archived":false,"open_issues_count":126,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":313,"open_issues":126,"watchers":1911,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yesodweb/yesod/pulls/1503"},"html":{"href":"https://github.com/yesodweb/yesod/pull/1503"},"issue":{"href":"https://api.github.com/repos/yesodweb/yesod/issues/1503"},"comments":{"href":"https://api.github.com/repos/yesodweb/yesod/issues/1503/comments"},"review_comments":{"href":"https://api.github.com/repos/yesodweb/yesod/pulls/1503/comments"},"review_comment":{"href":"https://api.github.com/repos/yesodweb/yesod/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yesodweb/yesod/pulls/1503/commits"},"statuses":{"href":"https://api.github.com/repos/yesodweb/yesod/statuses/955b21d7ea3c2166a139631a58656b0bd89d511b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"snoyberg"}}