You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which requires the underlying monad to have a MonadUnliftIO instance. But it is enough to implement withSinkFile with only a MonadMask, which is a strictly weaker constraint than MonadUnliftIO:
I'm not in favor of recommending MonadMask, which favors complicated and
unnecessary monad stacks. Making a change like that would additionally be
backwards incompatible.
On Wed, Jan 6, 2021 at 1:30 PM Poscat ***@***.***> wrote:
The current implementation of withSinkFile is:
withSinkFile
:: (MonadUnliftIO m, MonadIO n)
=> FilePath
-> (ConduitM ByteString o n () -> m a)
-> m a
withSinkFile fp inner =
withRunInIO $ \run ->
IO.withBinaryFile fp IO.WriteMode $
run . inner . sinkHandle
which requires the underlying monad to have a MonadUnliftIO instance. But
it is enough to implement withSinkFile with only a MonadMask, which is a
strictly weaker constraint than MonadUnliftIO:
withSinkFile :: (MonadMask m, MonadIO m, MonadIO n) => FilePath -> (ConduitT ByteString o n () -> m a) -> m a
withSinkFile fp k =
bracket
(liftIO . openBinaryFile WriteMode)
(liftIO . hClose)
(k . sinkHandle)
This is also true for a lot of other with* functions. It would be nice to
loosen the constraints on these functions.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#458>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAMCB3YQKWQNOK74B3V7JLSYRCVVANCNFSM4VXNAGNA>
.
The current implementation of
withSinkFile
is:which requires the underlying monad to have a
MonadUnliftIO
instance. But it is enough to implementwithSinkFile
with only aMonadMask
, which is a strictly weaker constraint thanMonadUnliftIO
:This is also true for a lot of other with* functions. It would be nice to loosen the constraints on these functions.
The text was updated successfully, but these errors were encountered: