Help finding ugly Generics examples?
Hey all,
What are some of the ugliest things you've seen done with Rusts Generics system?
I remember there were a bunch of posts back before HKTs and HOFs. Do ya'll have any saved?
Posted Oct 31, 2019, 2:24 AM UTC
My go-to type system abuse example is Frunk, mainly because they have such an approachable series of blog posts on how it does its magic:
HList (read me first): https://beachape.com/blog/2016/10/23/rust-hlists-heterogenously-typed-list
Generic (read me third): https://beachape.com/blog/2017/02/04/rust-generic-not-generics
LabelledGeneric (read me fourth): https://beachape.com/blog/2017/03/04/labelledgeneric-in-rust-what-why-how
HList again (read me second): https://beachape.com/blog/2017/03/12/gentle-intro-to-type-level-recursion-in-Rust-from-zero-to-frunk-hlist-sculpting
Transform (read me last): https://beachape.com/blog/2017/04/12/boilerplate-free-struct-transforms-in-rust
....And I just nerd snipped myself into rereading this series. It's an impressive masterclass on advanced type system (ab)use.