-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
for comprehensions seem broken #49
Comments
I finally figured this one out. IT's the difference between "ExtractableManagedResource" and a vanilla "ManagedResource". I think the library is assuming the value from teh for-expression is still "raw", i.e. you are trying to leak a resource out of the for-expression. ManagedResource is not a Monad in the sense of "the category of all types", a.k.a. Hask. It is only a monad in a limited subset of types + functions, hence the laws only apply within this subset. However, I do think this is a bug and I know how to fix it. |
To be clear, this line needs to change: https://github.com/jsuereth/scala-arm/blob/master/src/main/scala/resource/ManagedResource.scala#L56 and should return "ExtractableManagedResource" |
@jsuereth would you consider making this change now? |
@jsuereth would you consider making this change now? :) |
@jsuereth If I understand that would mean a breaking change as updating the return type of |
Yes, this would mean bumping major version. |
I noticed this strange behaviour:
That returns
"foo"
, as expected.Compare:
works just fine.
Maybe the
map
and/orflatMap
implementation is broken (i.e. not following the monad laws)?The text was updated successfully, but these errors were encountered: