Source code on Github
module Prelude.Indexable where

open import Prelude.Init; open SetAsType
import Prelude.Lists as L

record Indexable (A : Type ) (B : Type ℓ′) {ℓ″} : Type (lsuc ( ⊔ₗ ℓ′ ⊔ₗ ℓ″)) where
  field Ix  : Pred A ℓ″
        _‼_ : (a : A)  Ix a  B
open Indexable ⦃...⦄ public

private variable A : Type 

instance
  Index-List : Indexable (List A) A
  Index-List = λ where
    .Ix  L.Index
    ._‼_  L._‼_

  Index-Vec :  {n}  Indexable (Vec A n) A
  Index-Vec {n = n} = λ where
    .Ix _  Fin n
    ._‼_  V.lookup

_ = (List   0  1  2  3  4  [])  3F  3
   refl

_ = (Vec  5  0  1  2  3  4  [])  3F  3
   refl