beam icon indicating copy to clipboard operation
beam copied to clipboard

MonadIO constraint for runBeamSqlite

Open moll opened this issue 6 years ago • 2 comments

Hey!

Thanks for working on Beam! Have you considered having runBeamSqlite and similar monad runners return a monad in MonadIO so they could be used in non-IO, but in MonadIO contexts?

Thanks!

moll avatar Apr 05 '19 17:04 moll

So here's the thing with runBeam*, et al... they have a bracketed IO action in there which doesn't compose nicely with MonadIO. You need MonadBaseControl, but this too suffers from a few drawbacks. However, it is fairly straightforward with MonadBaseControl IO to lift the runBeam* functions in IO. I'm open to including lifted functions in a separate module though.

tathougies avatar Apr 05 '19 18:04 tathougies

I've found MonadMask to be a less surprising tool for getting general bracketing.

3noch avatar Apr 05 '19 18:04 3noch