1
|
1 replace : {n m : Level} {A : Set n} {t : Set m} → (env : Env A )
|
|
2 → (next : Env A → t )
|
|
3 → (exit : Env A → t) → t
|
|
4 replace env next exit = replace-c (varl env) env next exit where
|
|
5 replace-c : {n m : Level} {A : Set n} {t : Set m} → List (bt A) → (env : Env A )
|
|
6 → (next : Env A → t )
|
|
7 → (exit : Env A → t) → t
|
|
8 replace-c st env next exit with st
|
|
9 ... | [] = exit env
|
|
10 ... | leaf ∷ st1 = replace-c st1 env next exit
|
|
11 ... | n@(node key-t value ltree rtree) ∷ st1 with <-cmp (varn env) (key-t)
|
|
12 ... | tri< a ¬b ¬c = replace-c st1 record env{vart = (node key-t value (vart env) rtree); varl = st1} next exit
|
|
13 ... | tri≈ ¬a b ¬c = replace-c st1 record env{vart = (node key-t (varv env) ltree rtree); varl = st1} next exit
|
|
14 ... | tri> ¬a ¬b c = replace-c st1 record env{vart = (node key-t value ltree (vart env)); varl = st1} next exit |