by thesz · 1y ago · 0 comments
data N where
Z :: N
O :: N -> N
data T (n :: N) where
TZ :: T (O n)
TO :: T n -> T (O n)
To safely access an element in array you have to provide a proof that a telescope can be constructed for given index range.Dependent types do not add complexity to our system, they reveal it.
Case in point: here is a fully dependently-typed tensor processing framework written in Idris, which I believe matches most of the desiderata of his talk, capturing even a generalisation of arrays via Naperian functors that is mentioned at one point.