Skip to content

Instantly share code, notes, and snippets.

@timjb
Created March 6, 2019 15:05
Show Gist options
  • Save timjb/439898770ef0d1a0b370a2e38f69396e to your computer and use it in GitHub Desktop.
Save timjb/439898770ef0d1a0b370a2e38f69396e to your computer and use it in GitHub Desktop.
module SizedTrees where
open import Agda.Builtin.Size
data list (A : Set₀) : Set₀ where
nil : list A
cons : A list A list A
map : {A B} (A B) list A list B
map f nil = nil
map f (cons a l) = cons (f a) (map f l)
data tree (A : Set₀) : Size Set₀ where
fork : {i} A list (tree A i) tree A (↑ i)
map-tree : {i} {A B} (A B) tree A i tree B i
map-tree f (fork a l) = fork (f a) (map (map-tree f) l)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment