This PR helps make the Transaction type compatible with things that require MonadUnliftIO.
My motivation for this change was using Transaction together with ResourceT. runResourceT has a MonadUnliftIO constraint on it. The current lmdb-simple public API doesn't expose enough information to even write a newtype/orphan MonadUnliftIO instance for Transaction.
I implemented this in a dependency-less way: transactionWithRunInIO is the withRunInIO implementation for Transaction, and consumers of lmdb-simple can use it to write MonadUnliftIO for newtypes around Transaction.
If you don't mind taking on an unliftio-core dependency, I'd be happy to include a MonadUnliftIO instance instead. unliftio-core itself is very lightweight, only depending on base and transformers.
This PR helps make the
Transaction
type compatible with things that requireMonadUnliftIO
.My motivation for this change was using
Transaction
together withResourceT
.runResourceT
has aMonadUnliftIO
constraint on it. The currentlmdb-simple
public API doesn't expose enough information to even write a newtype/orphanMonadUnliftIO
instance forTransaction
.I implemented this in a dependency-less way:
transactionWithRunInIO
is thewithRunInIO
implementation forTransaction
, and consumers oflmdb-simple
can use it to writeMonadUnliftIO
for newtypes aroundTransaction
.If you don't mind taking on an
unliftio-core
dependency, I'd be happy to include aMonadUnliftIO
instance instead.unliftio-core
itself is very lightweight, only depending onbase
andtransformers
.