annotate lib/ur/top.urs @ 913:b26823138bf8

Fix structure wildification to take concrete con decls into account
author Adam Chlipala <adamc@hcoop.net>
date Tue, 25 Aug 2009 17:12:21 -0400
parents 8e540df3294d
children 37dd42935dad
rev   line source
adamc@623 1 (** Row folding *)
adamc@623 2
adamc@631 3 con folder :: K --> {K} -> Type
adamc@623 4
adamc@653 5 val fold : K --> tf :: ({K} -> Type)
adamc@653 6 -> (nm :: Name -> v :: K -> r :: {K} -> [[nm] ~ r] =>
adamc@653 7 tf r -> tf ([nm = v] ++ r))
adamc@653 8 -> tf []
adamc@653 9 -> r :: {K} -> folder r -> tf r
adamc@653 10
adamc@627 11 structure Folder : sig
adamc@627 12 val nil : K --> folder (([]) :: {K})
adamc@627 13 val cons : K --> r ::: {K} -> nm :: Name -> v :: K
adamc@629 14 -> [[nm] ~ r] => folder r -> folder ([nm = v] ++ r)
adamc@628 15 val concat : K --> r1 ::: {K} -> r2 ::: {K}
adamc@629 16 -> [r1 ~ r2] => folder r1 -> folder r2 -> folder (r1 ++ r2)
adamc@630 17 val mp : K1 --> K2 --> f ::: (K1 -> K2) -> r ::: {K1}
adamc@630 18 -> folder r -> folder (map f r)
adamc@627 19 end
adamc@627 20
adamc@623 21
adamc@422 22 val not : bool -> bool
adamc@422 23
adamc@898 24 con id = K ==> fn t :: K => t
adamc@329 25 con record = fn t :: {Type} => $t
adamc@637 26 con fst = K1 ==> K2 ==> fn t :: (K1 * K2) => t.1
adamc@637 27 con snd = K1 ==> K2 ==> fn t :: (K1 * K2) => t.2
adamc@637 28 con fst3 = K1 ==> K2 ==> K3 ==> fn t :: (K1 * K2 * K3) => t.1
adamc@637 29 con snd3 = K1 ==> K2 ==> K3 ==> fn t :: (K1 * K2 * K3) => t.2
adamc@637 30 con thd3 = K1 ==> K2 ==> K3 ==> fn t :: (K1 * K2 * K3) => t.3
adamc@329 31
adamc@643 32 con mapU = K ==> fn f :: K => map (fn _ :: Unit => f)
adamc@445 33
adamc@339 34 con ex = fn tf :: (Type -> Type) =>
adamc@355 35 res ::: Type -> (choice :: Type -> tf choice -> res) -> res
adamc@339 36
adamc@339 37 val ex : tf :: (Type -> Type) -> choice :: Type -> tf choice -> ex tf
adamc@339 38
adamc@325 39 val compose : t1 ::: Type -> t2 ::: Type -> t3 ::: Type
adamc@355 40 -> (t2 -> t3) -> (t1 -> t2) -> (t1 -> t3)
adamc@325 41
adamc@777 42 val show_option : t ::: Type -> show t -> show (option t)
adamc@777 43 val read_option : t ::: Type -> read t -> read (option t)
adamc@777 44
adamc@720 45 val txt : t ::: Type -> ctx ::: {Unit} -> use ::: {Type} -> show t -> t
adamc@720 46 -> xml ctx use []
adamc@329 47
adamc@898 48 val mp : K --> tf1 :: (K -> Type) -> tf2 :: (K -> Type)
adamc@898 49 -> (t ::: K -> tf1 t -> tf2 t)
adamc@898 50 -> r :: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r)
adamc@905 51 val map2 : K --> tf1 :: (K -> Type) -> tf2 :: (K -> Type) -> tf3 :: (K -> Type)
adamc@905 52 -> (t ::: K -> tf1 t -> tf2 t -> tf3 t)
adamc@905 53 -> r :: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r) -> $(map tf3 r)
adamc@898 54
adamc@411 55 val foldUR : tf :: Type -> tr :: ({Unit} -> Type)
adamc@411 56 -> (nm :: Name -> rest :: {Unit}
adamc@629 57 -> [[nm] ~ rest] =>
adamc@411 58 tf -> tr rest -> tr ([nm] ++ rest))
adamc@643 59 -> tr [] -> r :: {Unit} -> folder r -> $(mapU tf r) -> tr r
adamc@411 60
adamc@418 61 val foldUR2 : tf1 :: Type -> tf2 :: Type -> tr :: ({Unit} -> Type)
adamc@418 62 -> (nm :: Name -> rest :: {Unit}
adamc@629 63 -> [[nm] ~ rest] =>
adamc@418 64 tf1 -> tf2 -> tr rest -> tr ([nm] ++ rest))
adamc@643 65 -> tr [] -> r :: {Unit} -> folder r -> $(mapU tf1 r) -> $(mapU tf2 r) -> tr r
adamc@418 66
adamc@720 67 val foldURX2: tf1 :: Type -> tf2 :: Type -> ctx :: {Unit}
adamc@418 68 -> (nm :: Name -> rest :: {Unit}
adamc@629 69 -> [[nm] ~ rest] =>
adamc@720 70 tf1 -> tf2 -> xml ctx [] [])
adamc@720 71 -> r :: {Unit} -> folder r -> $(mapU tf1 r) -> $(mapU tf2 r) -> xml ctx [] []
adamc@418 72
adamc@623 73 val foldR : K --> tf :: (K -> Type) -> tr :: ({K} -> Type)
adamc@623 74 -> (nm :: Name -> t :: K -> rest :: {K}
adamc@629 75 -> [[nm] ~ rest] =>
adamc@355 76 tf t -> tr rest -> tr ([nm = t] ++ rest))
adamc@632 77 -> tr [] -> r :: {K} -> folder r -> $(map tf r) -> tr r
adamc@336 78
adamc@623 79 val foldR2 : K --> tf1 :: (K -> Type) -> tf2 :: (K -> Type)
adamc@623 80 -> tr :: ({K} -> Type)
adamc@623 81 -> (nm :: Name -> t :: K -> rest :: {K}
adamc@629 82 -> [[nm] ~ rest] =>
adamc@623 83 tf1 t -> tf2 t -> tr rest -> tr ([nm = t] ++ rest))
adamc@623 84 -> tr []
adamc@632 85 -> r :: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r) -> tr r
adamc@623 86
adamc@910 87 val foldR3 : K --> tf1 :: (K -> Type) -> tf2 :: (K -> Type) -> tf3 :: (K -> Type)
adamc@910 88 -> tr :: ({K} -> Type)
adamc@910 89 -> (nm :: Name -> t :: K -> rest :: {K}
adamc@910 90 -> [[nm] ~ rest] =>
adamc@910 91 tf1 t -> tf2 t -> tf3 t -> tr rest -> tr ([nm = t] ++ rest))
adamc@910 92 -> tr []
adamc@910 93 -> r :: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r) -> $(map tf3 r) -> tr r
adamc@910 94
adamc@720 95 val foldRX : K --> tf :: (K -> Type) -> ctx :: {Unit}
adamc@623 96 -> (nm :: Name -> t :: K -> rest :: {K}
adamc@629 97 -> [[nm] ~ rest] =>
adamc@720 98 tf t -> xml ctx [] [])
adamc@720 99 -> r :: {K} -> folder r -> $(map tf r) -> xml ctx [] []
adamc@623 100
adamc@720 101 val foldRX2 : K --> tf1 :: (K -> Type) -> tf2 :: (K -> Type) -> ctx :: {Unit}
adamc@623 102 -> (nm :: Name -> t :: K -> rest :: {K}
adamc@629 103 -> [[nm] ~ rest] =>
adamc@720 104 tf1 t -> tf2 t -> xml ctx [] [])
adamc@632 105 -> r :: {K} -> folder r
adamc@720 106 -> $(map tf1 r) -> $(map tf2 r) -> xml ctx [] []
adamc@445 107
adamc@910 108 val foldRX3 : K --> tf1 :: (K -> Type) -> tf2 :: (K -> Type) -> tf3 :: (K -> Type) -> ctx :: {Unit}
adamc@910 109 -> (nm :: Name -> t :: K -> rest :: {K}
adamc@910 110 -> [[nm] ~ rest] =>
adamc@910 111 tf1 t -> tf2 t -> tf3 t -> xml ctx [] [])
adamc@910 112 -> r :: {K} -> folder r
adamc@910 113 -> $(map tf1 r) -> $(map tf2 r) -> $(map tf3 r) -> xml ctx [] []
adamc@910 114
adamc@682 115 val queryI : tables ::: {{Type}} -> exps ::: {Type}
adamc@682 116 -> [tables ~ exps] =>
adamc@682 117 sql_query tables exps
adamc@682 118 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables)
adamc@682 119 -> transaction unit)
adamc@682 120 -> transaction unit
adamc@682 121
adamc@720 122 val queryX : tables ::: {{Type}} -> exps ::: {Type} -> ctx ::: {Unit}
adamc@629 123 -> [tables ~ exps] =>
adamc@632 124 sql_query tables exps
adamc@632 125 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables)
adamc@720 126 -> xml ctx [] [])
adamc@720 127 -> transaction (xml ctx [] [])
adamc@341 128
adamc@720 129 val queryX' : tables ::: {{Type}} -> exps ::: {Type} -> ctx ::: {Unit}
adamc@629 130 -> [tables ~ exps] =>
adamc@632 131 sql_query tables exps
adamc@632 132 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables)
adamc@720 133 -> transaction (xml ctx [] []))
adamc@720 134 -> transaction (xml ctx [] [])
adamc@469 135
adamc@355 136 val oneOrNoRows : tables ::: {{Type}} -> exps ::: {Type}
adamc@629 137 -> [tables ~ exps] =>
adamc@629 138 sql_query tables exps
adamc@629 139 -> transaction
adamc@629 140 (option
adamc@629 141 $(exps
adamc@629 142 ++ map (fn fields :: {Type} => $fields) tables))
adamc@440 143
adamc@440 144 val oneRow : tables ::: {{Type}} -> exps ::: {Type}
adamc@629 145 -> [tables ~ exps] =>
adamc@629 146 sql_query tables exps
adamc@629 147 -> transaction
adamc@629 148 $(exps
adamc@629 149 ++ map (fn fields :: {Type} => $fields) tables)
adamc@629 150
adamc@470 151 val eqNullable : tables ::: {{Type}} -> agg ::: {{Type}} -> exps ::: {Type}
adamc@470 152 -> t ::: Type -> sql_injectable (option t)
adamc@470 153 -> sql_exp tables agg exps (option t)
adamc@470 154 -> sql_exp tables agg exps (option t)
adamc@470 155 -> sql_exp tables agg exps bool
adamc@470 156
adamc@470 157 val eqNullable' : tables ::: {{Type}} -> agg ::: {{Type}} -> exps ::: {Type}
adamc@470 158 -> t ::: Type -> sql_injectable (option t)
adamc@470 159 -> sql_exp tables agg exps (option t)
adamc@470 160 -> option t
adamc@470 161 -> sql_exp tables agg exps bool