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 do a small bit of this in the coproduct embed PR, but I think there should be more:
There should be one central piece of documentation (which other methods can link to) describing the Index technique commonly used in frunk, describing how:
Users should generally not worry about Index type parameters. Even when using turbofish syntax (once available), these should generally be left to type inference using _.
Generally speaking, type inference can solve for the indices whenever there is a unique solution.
This means that methods like hlist's pluck and coproduct's inject succeed when the type appears exactly once in the HList/coproduct.
It should also explain workarounds for when type inference fails:
The preferred method, whenever possible, should be to use newtypes in your HList/coproduct, so that all of the types are distinct. (@Centril, @lloydmeta do you agree?)
As a last resort, indices can be specified explicitly, but I'm not sure that the docs should be suggesting this course of action quite yet as they feel mostly like an implementation detail. (maybe once reified indices are added, if I ever get to that; I still need to get more experience with them first in funky)
The text was updated successfully, but these errors were encountered:
Users should generally not worry about Index type parameters. Even when using turbofish syntax (once available), these should generally be left to type inference using _.
Agreed; Hopefully you won't even need to specify _ in the future with some sort of "partial turbofish" (see my RFC on this -- rust-lang/rfcs#2176) mechanism in the language itself.
Uh oh!
There was an error while loading. Please reload this page.
I do a small bit of this in the coproduct
embed
PR, but I think there should be more:There should be one central piece of documentation (which other methods can link to) describing the
Index
technique commonly used in frunk, describing how:Index
type parameters. Even when using turbofish syntax (once available), these should generally be left to type inference using_
.pluck
and coproduct'sinject
succeed when the type appears exactly once in the HList/coproduct.It should also explain workarounds for when type inference fails:
funky
)The text was updated successfully, but these errors were encountered: