resourcemight help there
Resource, you have
A => Resource?
useas an input
val getFirstResult = Stream.emits(inputs) .evalMap(resourceFor(input).use(operation).attempt) .dropWhile(_.isLeft) .take(1)
if you want to find the first working resource, acquire, and keep it open, that sucks, and is harder - please see my blog post on concurrent resource caching and adapt for your needs. https://gist.github.com/Daenyth/28243952f1fcfac6e8ef838040e8638e
operationis a function passed in, correct?
keypoolWIP package for
operationas a parameter, and just call
use, it's much easier
Resource[F, Either[Throwable, A]]