adam@6
|
1 (** Derived functions dealing with polymorphic variants *)
|
adam@6
|
2
|
adam@6
|
3 val read : r ::: {Unit} -> t ::: Type -> folder r -> $(mapU t r) -> variant (mapU {} r) -> t
|
adam@6
|
4 val write : r ::: {Unit} -> t ::: Type -> folder r -> $(mapU t r) -> variant (mapU {} r) -> t -> $(mapU t r)
|
adam@6
|
5
|
adam@6
|
6 val search : r ::: {Unit} -> t ::: Type -> (variant (mapU {} r) -> option t) -> folder r -> option t
|
adam@6
|
7 val find : r ::: {Unit} -> (variant (mapU {} r) -> bool) -> folder r -> option (variant (mapU {} r))
|
adam@6
|
8
|
adam@6
|
9 val test : nm :: Name -> t ::: Type -> ts ::: {Type} -> [[nm] ~ ts] => folder ([nm = t] ++ ts)
|
adam@6
|
10 -> variant ([nm = t] ++ ts) -> option t
|
adam@6
|
11 val testLess : nm :: Name -> t ::: Type -> ts ::: {Type} -> [[nm] ~ ts] => folder ts -> variant ([nm = t] ++ ts) -> option t
|
adam@6
|
12
|
adam@21
|
13 val weaken : r1 ::: {Type} -> r2 ::: {Type} -> [r1 ~ r2] => folder r1
|
adam@21
|
14 -> variant r1 -> variant (r1 ++ r2)
|
adam@21
|
15
|
adam@6
|
16 val testEq : K --> f :: (K -> Type) -> nm :: Name -> t ::: K -> ts ::: {K} -> r ::: {K} -> [[nm] ~ ts] =>
|
adam@6
|
17 Eq.eq r ([nm = t] ++ ts)
|
adam@6
|
18 -> folder r
|
adam@6
|
19 -> variant (map f r) -> option (f t)
|
adam@6
|
20
|
adam@6
|
21 val eq : r ::: {Unit} -> folder r -> variant (mapU {} r) -> variant (mapU {} r) -> bool
|
adam@6
|
22
|
adam@6
|
23 val makeEq : K --> f :: (K -> Type) -> nm :: Name -> t ::: K -> ts ::: {K} -> r ::: {K} -> [[nm] ~ ts] =>
|
adam@6
|
24 Eq.eq r ([nm = t] ++ ts)
|
adam@6
|
25 -> f t
|
adam@6
|
26 -> variant (map f r)
|
adam@6
|
27
|
adam@21
|
28 val mp : r ::: {Unit} -> t ::: Type -> folder r -> (variant (mapU {} r) -> t) -> $(mapU t r)
|
adam@21
|
29
|
adam@6
|
30 val fold : r ::: {Unit} -> t ::: Type -> folder r -> (variant (mapU {} r) -> t -> t) -> t -> t
|
adam@6
|
31
|
adam@20
|
32 val foldR : tr ::: Type -> r ::: {Unit} -> t ::: Type -> folder r -> (variant (mapU {} r) -> tr -> t -> t) -> $(mapU tr r) -> t -> t
|
adam@20
|
33
|
adam@20
|
34 val appR : m ::: (Type -> Type) -> monad m
|
adam@20
|
35 -> tr ::: Type -> r ::: {Unit} -> folder r -> (variant (mapU {} r) -> tr -> m {}) -> $(mapU tr r) -> m {}
|
adam@20
|
36
|
adam@21
|
37 val mapR : tr ::: Type -> t ::: Type -> r ::: {Unit} -> folder r -> (variant (mapU {} r) -> tr -> t) -> $(mapU tr r) -> $(mapU t r)
|
adam@21
|
38
|
adam@6
|
39 val destrR : K --> f :: (K -> Type) -> fr :: (K -> Type) -> t ::: Type
|
adam@6
|
40 -> (p :: K -> f p -> fr p -> t)
|
adam@6
|
41 -> r ::: {K} -> folder r -> variant (map f r) -> $(map fr r) -> t
|
adam@6
|
42
|
adam@6
|
43 val destr2R : K --> f1 :: (K -> Type) -> f2 :: (K -> Type) -> fr :: (K -> Type) -> t ::: Type
|
adam@6
|
44 -> (p :: K -> f1 p -> f2 p -> fr p -> t)
|
adam@6
|
45 -> r ::: {K} -> folder r -> variant (map f1 r) -> variant (map f2 r) -> $(map fr r) -> option t
|