Refinement types give us the ability to define validation rules, or more commonly called predicates, at the type level. This means we get compile-time validation whenever the values are known at compile-time. — Parallel typeclass for Haskell
Aside from the compilation aspect, I think that assert
like statements (in Stata or Python) are very close to the above statement in statistical programming.