Lifting the mond in conduit

62 Views Asked by At

I’m trying to consume an streamed http response. Problem is httpSource expects a MonadResource in the output conduit and I’m in IO so I figured I would get out a ResourceT IO :

main :: IO ()
main = do
  let c :: ConduitT () (Either String ServerEvent) (ResourceT IO) ()
      c = httpSource "http://localhost:3000/sse" $ toSrc . responseBody
  return ()
  where ...

Now I’m stuck with a c that is a conduit of ResourceT IO and about the only thing I can do is to runResourceT which I don't want. What I want is to get the same type but with IO :

ConduitT () (Either String ServerEvent) IO ()

I thought this must be easy but apparently not! best I could find was the https://hackage.haskell.org/package/conduit-1.3.4.3/docs/Data-Conduit-Lift.html which as far as I can see is not relevant to my case (I could be wrong though).

0

There are 0 best solutions below