I'm using scala-arm library to automatically release/close resources (for example InputStream).
But the problem is that code below returns ExtractableManagedResource[Int], not just Int as I want.
val result = for(responseStream <- managed(response.getResponseBodyAsStream)) yield {
val localResult: Int = 1
localResult
}
// result is of type ExtractableManagedResource[Int]
Is there any option to return Int and overcome wrapping result to ExtractableManagedResource?
EDIT: I know that I can just declre result variable as var and assign to it from inside the for-comprehension, but I want more scala-idiomatic way, i.e. without using var
this is easier to implement with the monadic approach by using the aquireAndGet feature