I think many people know about Data.Some.Newtype
—it uses quite a cute (and cursed) trick to encode a simple existential wrapper as a newtype
, hence avoiding an unwanted indirection in the runtime representation.
But there's more to data
than existentials—so how far do these tricks go?
The answer is: surprisingly far!
Let's see what other GADTs we can slim down.