Source code on Github
{-# OPTIONS --cubical-compatible #-}
module Class.ToList where

open import Class.Prelude

record ToList (A : Type ) (B : Type ℓ′) : Type (  ℓ′) where
  field toList : A  List B
  _∙toList = toList
open ToList ⦃...⦄ public

instance
  ToList-List : ToList (List A) A
  ToList-List .toList = id

  ToList-List⁺ : ToList (List⁺ A) A
  ToList-List⁺ .toList = L⁺.toList

  ToList-Str : ToList String Char
  ToList-Str .toList = Str.toList

  ToList-Vec :  {n}  ToList (Vec A n) A
  ToList-Vec .toList = V.toList