GADTs and a few of the wilder Haskell extensions sort-of go a bit in that direction.
But yes, you have to wrap your head around dependent types.