Filtering GADT Vectors: Runtime Predicates & Type Safety
Summary The core problem revolves around the incompatibility between value-dependent logic and type-level invariants. Specifically, when using Generalized Algebraic Data Types (GADTs) like a length-indexed Vec, the type system requires the length n to be known at compile time. However, the filter operation is inherently non-deterministic at the type level because the number of elements … Read more