lloydmeta / frunk

Funktional generic type-level programming in Rust: HList, Coproduct, Generic, LabelledGeneric, Validated, Monoid and friends.
https://beachape.com/frunk/
MIT License
1.23k stars 56 forks source link

Documenting rules for when type inference can solve for indices #94

Open ExpHP opened 6 years ago

ExpHP commented 6 years ago

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:

It should also explain workarounds for when type inference fails:

Centril commented 6 years ago

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 -- https://github.com/rust-lang/rfcs/pull/2176) mechanism in the language itself.

I also agree with everything else you said.