We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
E.g.
f := result.Wrap(os.Open("foo")) result.MapE(io.ReadAll)
doesn't compile because in MapE we have B = *os.File which implements io.Reader but is not identical to it...
MapE
B = *os.File
io.Reader
The text was updated successfully, but these errors were encountered:
Doesn't work because among other things https://go.dev/doc/faq#covariant_types.
//edit: The reason I still think this is more of a generics issue than a covariant types issue is that the following works:
func c[A any, B interface{ io.Reader }](f func(A) B, g func(io.Reader) string) func(A) string { return func(a A) string { return g(f(a)) } }
but the rules for constraints currently prohibit using a type parameter inside interface {}.
interface {}
Sorry, something went wrong.
See also golang/go#58650
Collected examples from the discussion on the Gopher slack...
No branches or pull requests
E.g.
doesn't compile because in
MapE
we haveB = *os.File
which implementsio.Reader
but is not identical to it...The text was updated successfully, but these errors were encountered: