Open BalmungSan opened 1 year ago
Another idea would be to warn if
use
returns anF[A]
rather than someF[B]
(meaning the same type of theResource
)
FWIW I really like this idea. Whereas a "pure
" based fix can probably be implemented as a syntactic rule, inspecting the inferred types will require a semantic rule.
Since I don't know much about scalafix not sure how hard, or even impossible, this will be... But, it would be great to warn / error if someone tries to leak a
Resource
usingpure
ordelay
insideuse
; which is a somewhat common beginner mistake.Maybe a best effort that tries to catch common variations like
ra.use(a => a.pure[F])
orra.use(IO.apply)
can be enough? Another idea would be to warn ifuse
returns anF[A]
rather than someF[B]
(meaning the same type of theResource
), since on the surface it seems that would never be a good idea; but I may be being too naive.