{"action":"created","issue":{"url":"https://api.github.com/repos/haskell-servant/servant/issues/286","labels_url":"https://api.github.com/repos/haskell-servant/servant/issues/286/labels{/name}","comments_url":"https://api.github.com/repos/haskell-servant/servant/issues/286/comments","events_url":"https://api.github.com/repos/haskell-servant/servant/issues/286/events","html_url":"https://github.com/haskell-servant/servant/issues/286","id":120598513,"number":286,"title":"Is EitherT the right Monad for the server functions?","user":{"login":"ondrap","id":191226,"avatar_url":"https://avatars.githubusercontent.com/u/191226?v=3","gravatar_id":"","url":"https://api.github.com/users/ondrap","html_url":"https://github.com/ondrap","followers_url":"https://api.github.com/users/ondrap/followers","following_url":"https://api.github.com/users/ondrap/following{/other_user}","gists_url":"https://api.github.com/users/ondrap/gists{/gist_id}","starred_url":"https://api.github.com/users/ondrap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ondrap/subscriptions","organizations_url":"https://api.github.com/users/ondrap/orgs","repos_url":"https://api.github.com/users/ondrap/repos","events_url":"https://api.github.com/users/ondrap/events{/privacy}","received_events_url":"https://api.github.com/users/ondrap/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-12-06T00:40:39Z","updated_at":"2015-12-11T17:58:44Z","closed_at":null,"body":"According to https://www.fpcomplete.com/user/commercial/content/exceptions-best-practices 'It is almost always wrong to wrap an `ExceptT`, `EitherT`, or `ErrorT` around an `IO`-based transformer stack.' \r\n\r\nI have just found in my code a nice example:\r\n````\r\ngetUser dbpool userid = runSqlPool dbpool $ maybe (lift $ left err404) return $ get userid\r\n````\r\n\r\nThis is wrong, as the rollback in `runSqlPool` doesn't get called. I decided to convert all my server code completely to `IO` and use `enter` to convert back to `EitherT` - and throw exceptions as: `throwServant err404`. Is there any fundamental reason to use `EitherT` as opposed to `IO` with exceptions? It seems to me that IO would be a more sensible default, although I understand this would be quite a big API change."},"comment":{"url":"https://api.github.com/repos/haskell-servant/servant/issues/comments/164004027","html_url":"https://github.com/haskell-servant/servant/issues/286#issuecomment-164004027","issue_url":"https://api.github.com/repos/haskell-servant/servant/issues/286","id":164004027,"user":{"login":"jkarni","id":1657498,"avatar_url":"https://avatars.githubusercontent.com/u/1657498?v=3","gravatar_id":"","url":"https://api.github.com/users/jkarni","html_url":"https://github.com/jkarni","followers_url":"https://api.github.com/users/jkarni/followers","following_url":"https://api.github.com/users/jkarni/following{/other_user}","gists_url":"https://api.github.com/users/jkarni/gists{/gist_id}","starred_url":"https://api.github.com/users/jkarni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkarni/subscriptions","organizations_url":"https://api.github.com/users/jkarni/orgs","repos_url":"https://api.github.com/users/jkarni/repos","events_url":"https://api.github.com/users/jkarni/events{/privacy}","received_events_url":"https://api.github.com/users/jkarni/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T17:58:44Z","updated_at":"2015-12-11T17:58:44Z","body":"[Here's](https://gist.github.com/jkarni/ab02b5136aa762f904e1) what I was thinking. Kind of ugly, but seems to work"}}