annotate lib/ur/top.urs @ 799:9330ba3a2799

cselect.onchange
author Adam Chlipala <adamc@hcoop.net>
date Thu, 14 May 2009 11:04:56 -0400
parents 87a7702d681d
children d1d0b18afd3d
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@329 24 con idT = fn t :: Type => 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@411 48 val foldUR : tf :: Type -> tr :: ({Unit} -> Type)
adamc@411 49 -> (nm :: Name -> rest :: {Unit}
adamc@629 50 -> [[nm] ~ rest] =>
adamc@411 51 tf -> tr rest -> tr ([nm] ++ rest))
adamc@643 52 -> tr [] -> r :: {Unit} -> folder r -> $(mapU tf r) -> tr r
adamc@411 53
adamc@418 54 val foldUR2 : tf1 :: Type -> tf2 :: Type -> tr :: ({Unit} -> Type)
adamc@418 55 -> (nm :: Name -> rest :: {Unit}
adamc@629 56 -> [[nm] ~ rest] =>
adamc@418 57 tf1 -> tf2 -> tr rest -> tr ([nm] ++ rest))
adamc@643 58 -> tr [] -> r :: {Unit} -> folder r -> $(mapU tf1 r) -> $(mapU tf2 r) -> tr r
adamc@418 59
adamc@720 60 val foldURX2: tf1 :: Type -> tf2 :: Type -> ctx :: {Unit}
adamc@418 61 -> (nm :: Name -> rest :: {Unit}
adamc@629 62 -> [[nm] ~ rest] =>
adamc@720 63 tf1 -> tf2 -> xml ctx [] [])
adamc@720 64 -> r :: {Unit} -> folder r -> $(mapU tf1 r) -> $(mapU tf2 r) -> xml ctx [] []
adamc@418 65
adamc@623 66 val foldR : K --> tf :: (K -> Type) -> tr :: ({K} -> Type)
adamc@623 67 -> (nm :: Name -> t :: K -> rest :: {K}
adamc@629 68 -> [[nm] ~ rest] =>
adamc@355 69 tf t -> tr rest -> tr ([nm = t] ++ rest))
adamc@632 70 -> tr [] -> r :: {K} -> folder r -> $(map tf r) -> tr r
adamc@336 71
adamc@623 72 val foldR2 : K --> tf1 :: (K -> Type) -> tf2 :: (K -> Type)
adamc@623 73 -> tr :: ({K} -> Type)
adamc@623 74 -> (nm :: Name -> t :: K -> rest :: {K}
adamc@629 75 -> [[nm] ~ rest] =>
adamc@623 76 tf1 t -> tf2 t -> tr rest -> tr ([nm = t] ++ rest))
adamc@623 77 -> tr []
adamc@632 78 -> r :: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r) -> tr r
adamc@623 79
adamc@720 80 val foldRX : K --> tf :: (K -> Type) -> ctx :: {Unit}
adamc@623 81 -> (nm :: Name -> t :: K -> rest :: {K}
adamc@629 82 -> [[nm] ~ rest] =>
adamc@720 83 tf t -> xml ctx [] [])
adamc@720 84 -> r :: {K} -> folder r -> $(map tf r) -> xml ctx [] []
adamc@623 85
adamc@720 86 val foldRX2 : K --> tf1 :: (K -> Type) -> tf2 :: (K -> Type) -> ctx :: {Unit}
adamc@623 87 -> (nm :: Name -> t :: K -> rest :: {K}
adamc@629 88 -> [[nm] ~ rest] =>
adamc@720 89 tf1 t -> tf2 t -> xml ctx [] [])
adamc@632 90 -> r :: {K} -> folder r
adamc@720 91 -> $(map tf1 r) -> $(map tf2 r) -> xml ctx [] []
adamc@445 92
adamc@682 93 val queryI : tables ::: {{Type}} -> exps ::: {Type}
adamc@682 94 -> [tables ~ exps] =>
adamc@682 95 sql_query tables exps
adamc@682 96 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables)
adamc@682 97 -> transaction unit)
adamc@682 98 -> transaction unit
adamc@682 99
adamc@720 100 val queryX : tables ::: {{Type}} -> exps ::: {Type} -> ctx ::: {Unit}
adamc@629 101 -> [tables ~ exps] =>
adamc@632 102 sql_query tables exps
adamc@632 103 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables)
adamc@720 104 -> xml ctx [] [])
adamc@720 105 -> transaction (xml ctx [] [])
adamc@341 106
adamc@720 107 val queryX' : tables ::: {{Type}} -> exps ::: {Type} -> ctx ::: {Unit}
adamc@629 108 -> [tables ~ exps] =>
adamc@632 109 sql_query tables exps
adamc@632 110 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables)
adamc@720 111 -> transaction (xml ctx [] []))
adamc@720 112 -> transaction (xml ctx [] [])
adamc@469 113
adamc@355 114 val oneOrNoRows : tables ::: {{Type}} -> exps ::: {Type}
adamc@629 115 -> [tables ~ exps] =>
adamc@629 116 sql_query tables exps
adamc@629 117 -> transaction
adamc@629 118 (option
adamc@629 119 $(exps
adamc@629 120 ++ map (fn fields :: {Type} => $fields) tables))
adamc@440 121
adamc@440 122 val oneRow : tables ::: {{Type}} -> exps ::: {Type}
adamc@629 123 -> [tables ~ exps] =>
adamc@629 124 sql_query tables exps
adamc@629 125 -> transaction
adamc@629 126 $(exps
adamc@629 127 ++ map (fn fields :: {Type} => $fields) tables)
adamc@629 128
adamc@470 129 val eqNullable : tables ::: {{Type}} -> agg ::: {{Type}} -> exps ::: {Type}
adamc@470 130 -> t ::: Type -> sql_injectable (option t)
adamc@470 131 -> sql_exp tables agg exps (option t)
adamc@470 132 -> sql_exp tables agg exps (option t)
adamc@470 133 -> sql_exp tables agg exps bool
adamc@470 134
adamc@470 135 val eqNullable' : tables ::: {{Type}} -> agg ::: {{Type}} -> exps ::: {Type}
adamc@470 136 -> t ::: Type -> sql_injectable (option t)
adamc@470 137 -> sql_exp tables agg exps (option t)
adamc@470 138 -> option t
adamc@470 139 -> sql_exp tables agg exps bool