1lab icon indicating copy to clipboard operation
1lab copied to clipboard

Refactor Data.Vec to use a refinement type ala `Fin`

Open TOTBWF opened this issue 4 months ago • 2 comments

It might be worth considering replacing Data.Vec with a refinement type like

record Vec {ℓ} (A : Type ℓ) (n : Nat) : Type ℓ where
  constructor vec
  field
    lower : List A
    bounded : Irr (length lower ≡ n)

We still wont get good transports along refl due to transpList, but at least we can share functions between lists and vectors, and avoid storing the length of the vector on every cons-cell.

TOTBWF avatar Sep 17 '25 17:09 TOTBWF

and avoid storing the length of the vector on every cons-cell.

agda already does this

plt-amy avatar Sep 17 '25 20:09 plt-amy

Ah, forgot about forcing analysis :) Still think that it could be worthwhile for code re-use reasons

TOTBWF avatar Sep 18 '25 12:09 TOTBWF