{"action":"opened","issue":{"url":"https://api.github.com/repos/michaelt/streaming/issues/12","repository_url":"https://api.github.com/repos/michaelt/streaming","labels_url":"https://api.github.com/repos/michaelt/streaming/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/michaelt/streaming/issues/12/comments","events_url":"https://api.github.com/repos/michaelt/streaming/issues/12/events","html_url":"https://github.com/michaelt/streaming/issues/12","id":147572168,"number":12,"title":"MonadBaseControl","user":{"login":"echatav","id":2265940,"avatar_url":"https://avatars.githubusercontent.com/u/2265940?v=3","gravatar_id":"","url":"https://api.github.com/users/echatav","html_url":"https://github.com/echatav","followers_url":"https://api.github.com/users/echatav/followers","following_url":"https://api.github.com/users/echatav/following{/other_user}","gists_url":"https://api.github.com/users/echatav/gists{/gist_id}","starred_url":"https://api.github.com/users/echatav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/echatav/subscriptions","organizations_url":"https://api.github.com/users/echatav/orgs","repos_url":"https://api.github.com/users/echatav/repos","events_url":"https://api.github.com/users/echatav/events{/privacy}","received_events_url":"https://api.github.com/users/echatav/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-11T22:19:02Z","updated_at":"2016-04-11T22:19:02Z","closed_at":null,"body":"Hi, I'm trying to stream rows from postgresql databases using the [postgresl-simple library](https://hackage.haskell.org/package/postgresql-simple). Specifically, there's a [forEach](https://hackage.haskell.org/package/postgresql-simple-0.5.1.2/docs/Database-PostgreSQL-Simple.html#g:17) function. The problem is that it's a CPS calculation in IO. What I want to be able to do is:\r\n\r\n```haskell\r\nstreamRows :: (PG.ToRow q, PG.FromRow r) => PG.Connection -> PG.Query -> q -> Stream (Of r) IO ()\r\nstreamRows conn query params = liftBaseOp (PG.forEach conn query params) S.yield\r\n```\r\n\r\nwhich gives the type error\r\n\r\n```haskell\r\n        Couldn't match type ‘StM (Stream (Of r) IO) ()’ with ‘()’\r\n        Expected type: (r -> IO (StM (Stream (Of r) IO) ()))\r\n                       -> IO (StM (Stream (Of r) IO) ())\r\n          Actual type: (r -> IO ()) -> IO ()\r\n        Relevant bindings include\r\n          streamRows :: PG.Connection -> PG.Query -> q -> Stream (Of r) IO ()\r\n        In the first argument of ‘liftBaseOp’, namely\r\n          ‘(PG.forEach conn query params)’\r\n        In the expression:\r\n          liftBaseOp (PG.forEach conn query params) S.yield\r\n```\r\n\r\nbecause there is no `instance MonadBaseControl m (Stream f m)`. Would it be possible to construct this instance? If not is there a way around this problem? Thanks."}}