Skip to content

Make Req an instance of MonadUnliftIO #100

@sjshuck

Description

@sjshuck

It seems that the monad-control package is only used to make instances for MonadBase IO Req and MonadBaseControl IO Req. Since Req is implemented as a newtype wrapping ReaderT _something IO, it's safe to do

instance MonadUnliftIO Req where
    withRunInIO = liftBaseWith

thereby enabling req consumers following the ReaderT pattern to do all the things possible with monad-control without incurring it as a dependency.
Even if the monad-control instances are offered long-term, for backwards compatibility or any other reason, at least please offer MonadUnliftIO in addition. The unliftio-core package is tiny and the implementation is just these two lines.
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions