You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've ran into this problem with other functions like allocated as well (though surprisingly they were all on Dotty). Almost every Resource function widens F to G, but how useful is that in practice? Maybe there's something in fs2, but I've never actually seen or used it before.
Resource was made covariant in #731, I think it might be useful when someone's F is IO[SpecificException, *] and they want to automatically upcast it to IO[Throwable, *], for example. See #617
I think we can remove the type annotation in useForever for some reason (the REPL allowed me to do it) but not for allocated. If we keep that variance, that is.
Ahh, that makes sense, thanks for the context. I'm one of those IO-only users :) I'll post some of the failing Dotty snippets here later because I think it's related but it does typecheck in 2.13.
Because of a mix of variance, widening and
Nothing
, this code doesn't compile:If you annotate it as
useForever[IO]
, it works. A possible solution to this might involve removing theG[x] >: F[x]
parameter inuseForever
.The text was updated successfully, but these errors were encountered: