{"action":"created","issue":{"url":"https://api.github.com/repos/Gabriel439/Haskell-Pipes-Safe-Library/issues/22","labels_url":"https://api.github.com/repos/Gabriel439/Haskell-Pipes-Safe-Library/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/Gabriel439/Haskell-Pipes-Safe-Library/issues/22/comments","events_url":"https://api.github.com/repos/Gabriel439/Haskell-Pipes-Safe-Library/issues/22/events","html_url":"https://github.com/Gabriel439/Haskell-Pipes-Safe-Library/issues/22","id":95254314,"number":22,"title":"Threading safe monads into writeFile/readFile","user":{"login":"aemxdp","id":10787043,"avatar_url":"https://avatars.githubusercontent.com/u/10787043?v=3","gravatar_id":"","url":"https://api.github.com/users/aemxdp","html_url":"https://github.com/aemxdp","followers_url":"https://api.github.com/users/aemxdp/followers","following_url":"https://api.github.com/users/aemxdp/following{/other_user}","gists_url":"https://api.github.com/users/aemxdp/gists{/gist_id}","starred_url":"https://api.github.com/users/aemxdp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aemxdp/subscriptions","organizations_url":"https://api.github.com/users/aemxdp/orgs","repos_url":"https://api.github.com/users/aemxdp/repos","events_url":"https://api.github.com/users/aemxdp/events{/privacy}","received_events_url":"https://api.github.com/users/aemxdp/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-15T18:05:05Z","updated_at":"2015-07-21T03:34:17Z","closed_at":"2015-07-15T19:01:01Z","body":"Currently Pipes.Safe.Prelude defines writeFile as this:\r\n```haskell\r\nwriteFile :: MonadSafe m => FilePath -> Consumer' String m r\r\nwriteFile file = withFile file IO.WriteMode P.toHandle\r\n```\r\nIt seems, as all resource management is local to consumer, we can relax this to MonadIO, as there is no point in threading some safe monad into this pipe:\r\n```haskell\r\nwriteFile :: MonadIO m => FilePath -> Consumer' String m r\r\nwriteFile file = hoist (liftIO . runSafeT) $ withFile file IO.WriteMode P.toHandle\r\n```\r\nAm I missing something?"},"comment":{"url":"https://api.github.com/repos/Gabriel439/Haskell-Pipes-Safe-Library/issues/comments/123141259","html_url":"https://github.com/Gabriel439/Haskell-Pipes-Safe-Library/issues/22#issuecomment-123141259","issue_url":"https://api.github.com/repos/Gabriel439/Haskell-Pipes-Safe-Library/issues/22","id":123141259,"user":{"login":"Gabriel439","id":1313787,"avatar_url":"https://avatars.githubusercontent.com/u/1313787?v=3","gravatar_id":"","url":"https://api.github.com/users/Gabriel439","html_url":"https://github.com/Gabriel439","followers_url":"https://api.github.com/users/Gabriel439/followers","following_url":"https://api.github.com/users/Gabriel439/following{/other_user}","gists_url":"https://api.github.com/users/Gabriel439/gists{/gist_id}","starred_url":"https://api.github.com/users/Gabriel439/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gabriel439/subscriptions","organizations_url":"https://api.github.com/users/Gabriel439/orgs","repos_url":"https://api.github.com/users/Gabriel439/repos","events_url":"https://api.github.com/users/Gabriel439/events{/privacy}","received_events_url":"https://api.github.com/users/Gabriel439/received_events","type":"User","site_admin":false},"created_at":"2015-07-21T03:34:17Z","updated_at":"2015-07-21T03:34:17Z","body":"I also forgot to mention that [the documentation and tutorial in `Control.Monad.Morph`](http://hackage.haskell.org/package/mmorph-1.0.4/docs/Control-Monad-Morph.html) goes into this topic in much more detail."}}