module SizedTypes where
open import Size
open import Coalgebras using (ListF; nil; cons; mapF)
record Colist i A : Set where
coinductive
field force : ∀{j : Size< i} → ListF A (Colist j A)
open Colist
[] : ∀{i A} → Colist (↑ i) A
force [] = nil
_∷_ : ∀{i A} → A → Colist i A → Colist (↑ i) A
force (a ∷ as) = cons a as
unfold : ∀{i A S} (t : S → ListF A S) → S → Colist i A
force (unfold t s) = mapF (unfold t) (t s)
e-unfold : ∀ i {A S} (t : S → ListF A S) → S → Colist i A
force (e-unfold i t s) {j} = mapF (e-unfold j t) (t s)