I am working on a website using Yesod and am trying to stream a file from a zip archive into the HTTP response.
I choose the zip package, the relevant function is getEntrySource.
It returns a
ConduitT () ByteString m ()
where m has to satisfy
PrimMonad m MonadThrow mMonadResource m One type that would fit those constraints would be ResourceT IO
In order to stream data Yesod provides the respondSource function that takes a
ConduitT () (Flush Builder) (HandlerFor site) ()
My Problem is:
ResourceT IO would work for getEntrySource but respondSource expects a HandlerFor site. I found the transPipe function but I don't think unwrapping the ResourceT IO and wrapping every chunk in a HandlerFor site is what I want.
HandlerFor site isn't an instance of PrimMonad and I don't grasp PrimMonad enough to judge whether it would even make sense for it to be.
Looks like a pure oversight that HandlerFor isn't an instance of PrimMonad. I've pushed a commit that should address this, and will release to Hackage once CI tells me it's safe.