I’m wondering if there is any library that helps managing closing of resources in an async/Future context, just like scala-arm does for the synchronous case.
At the moment I’m using some simple RYO helper method on top of scala-arm Resource:
def managedAsync[A : Resource, B](a: => A)(f: A => Future[B])(implicit ctx: ExecutionContext): Future[B]
However, this feels clumsy, doesn’t scale nicely for nested resource acquisition like scala-arm’s monadic approach does, etc.
I have found RAII.scala, but I have to admit that at first glance I’m a bit scared by its deep scalaz integration. (So far, we’ve only been using scalaz’s Validation.)
Are there any experiences with RAII.scala, recommendations for other libs to look into, or suggestions for patterns to implement?
Thanks and best regards,