annotate lib/top.urs @ 439:322c8620bbdf

Marshaling time to SQL
author Adam Chlipala <adamc@hcoop.net>
date Thu, 30 Oct 2008 15:11:37 -0400
parents 0ce90d4d9ae7
children 19d7f79cd584
rev   line source
adamc@422 1 val not : bool -> bool
adamc@422 2
adamc@329 3 con idT = fn t :: Type => t
adamc@329 4 con record = fn t :: {Type} => $t
adamc@339 5 con fstTT = fn t :: (Type * Type) => t.1
adamc@339 6 con sndTT = fn t :: (Type * Type) => t.2
adamc@329 7
adamc@355 8 con mapTT = fn f :: Type -> Type => fold (fn nm t acc [[nm] ~ acc] =>
adamc@355 9 [nm = f t] ++ acc) []
adamc@325 10
adamc@411 11 con mapUT = fn f :: Type => fold (fn nm t acc [[nm] ~ acc] =>
adamc@411 12 [nm = f] ++ acc) []
adamc@411 13
adamc@355 14 con mapT2T = fn f :: (Type * Type) -> Type => fold (fn nm t acc [[nm] ~ acc] =>
adamc@355 15 [nm = f t] ++ acc) []
adamc@339 16
adamc@339 17 con ex = fn tf :: (Type -> Type) =>
adamc@355 18 res ::: Type -> (choice :: Type -> tf choice -> res) -> res
adamc@339 19
adamc@339 20 val ex : tf :: (Type -> Type) -> choice :: Type -> tf choice -> ex tf
adamc@339 21
adamc@325 22 val compose : t1 ::: Type -> t2 ::: Type -> t3 ::: Type
adamc@355 23 -> (t2 -> t3) -> (t1 -> t2) -> (t1 -> t3)
adamc@325 24
adamc@325 25 val txt : t ::: Type -> ctx ::: {Unit} -> use ::: {Type} -> show t -> t
adamc@355 26 -> xml ctx use []
adamc@329 27
adamc@411 28 val foldUR : tf :: Type -> tr :: ({Unit} -> Type)
adamc@411 29 -> (nm :: Name -> rest :: {Unit}
adamc@411 30 -> fn [[nm] ~ rest] =>
adamc@411 31 tf -> tr rest -> tr ([nm] ++ rest))
adamc@411 32 -> tr [] -> r :: {Unit} -> $(mapUT tf r) -> tr r
adamc@411 33
adamc@418 34 val foldUR2 : tf1 :: Type -> tf2 :: Type -> tr :: ({Unit} -> Type)
adamc@418 35 -> (nm :: Name -> rest :: {Unit}
adamc@418 36 -> fn [[nm] ~ rest] =>
adamc@418 37 tf1 -> tf2 -> tr rest -> tr ([nm] ++ rest))
adamc@418 38 -> tr [] -> r :: {Unit} -> $(mapUT tf1 r) -> $(mapUT tf2 r) -> tr r
adamc@418 39
adamc@418 40 val foldURX2: tf1 :: Type -> tf2 :: Type -> ctx :: {Unit}
adamc@418 41 -> (nm :: Name -> rest :: {Unit}
adamc@418 42 -> fn [[nm] ~ rest] =>
adamc@418 43 tf1 -> tf2 -> xml ctx [] [])
adamc@418 44 -> r :: {Unit} -> $(mapUT tf1 r) -> $(mapUT tf2 r) -> xml ctx [] []
adamc@418 45
adamc@336 46 val foldTR : tf :: (Type -> Type) -> tr :: ({Type} -> Type)
adamc@355 47 -> (nm :: Name -> t :: Type -> rest :: {Type}
adamc@355 48 -> fn [[nm] ~ rest] =>
adamc@355 49 tf t -> tr rest -> tr ([nm = t] ++ rest))
adamc@355 50 -> tr [] -> r :: {Type} -> $(mapTT tf r) -> tr r
adamc@336 51
adamc@339 52 val foldT2R : tf :: ((Type * Type) -> Type) -> tr :: ({(Type * Type)} -> Type)
adamc@355 53 -> (nm :: Name -> t :: (Type * Type) -> rest :: {(Type * Type)}
adamc@355 54 -> fn [[nm] ~ rest] =>
adamc@355 55 tf t -> tr rest -> tr ([nm = t] ++ rest))
adamc@355 56 -> tr [] -> r :: {(Type * Type)} -> $(mapT2T tf r) -> tr r
adamc@339 57
adamc@355 58 val foldTR2 : tf1 :: (Type -> Type) -> tf2 :: (Type -> Type)
adamc@355 59 -> tr :: ({Type} -> Type)
adamc@355 60 -> (nm :: Name -> t :: Type -> rest :: {Type}
adamc@355 61 -> fn [[nm] ~ rest] =>
adamc@355 62 tf1 t -> tf2 t -> tr rest -> tr ([nm = t] ++ rest))
adamc@355 63 -> tr []
adamc@355 64 -> r :: {Type} -> $(mapTT tf1 r) -> $(mapTT tf2 r) -> tr r
adamc@355 65
adamc@339 66 val foldT2R2 : tf1 :: ((Type * Type) -> Type) -> tf2 :: ((Type * Type) -> Type)
adamc@355 67 -> tr :: ({(Type * Type)} -> Type)
adamc@355 68 -> (nm :: Name -> t :: (Type * Type) -> rest :: {(Type * Type)}
adamc@355 69 -> fn [[nm] ~ rest] =>
adamc@355 70 tf1 t -> tf2 t -> tr rest -> tr ([nm = t] ++ rest))
adamc@355 71 -> tr [] -> r :: {(Type * Type)}
adamc@355 72 -> $(mapT2T tf1 r) -> $(mapT2T tf2 r) -> tr r
adamc@339 73
adamc@336 74 val foldTRX : tf :: (Type -> Type) -> ctx :: {Unit}
adamc@355 75 -> (nm :: Name -> t :: Type -> rest :: {Type}
adamc@355 76 -> fn [[nm] ~ rest] =>
adamc@355 77 tf t -> xml ctx [] [])
adamc@355 78 -> r :: {Type} -> $(mapTT tf r) -> xml ctx [] []
adamc@336 79
adamc@339 80 val foldT2RX : tf :: ((Type * Type) -> Type) -> ctx :: {Unit}
adamc@355 81 -> (nm :: Name -> t :: (Type * Type) -> rest :: {(Type * Type)}
adamc@355 82 -> fn [[nm] ~ rest] =>
adamc@355 83 tf t -> xml ctx [] [])
adamc@355 84 -> r :: {(Type * Type)} -> $(mapT2T tf r) -> xml ctx [] []
adamc@339 85
adamc@332 86 val foldTRX2 : tf1 :: (Type -> Type) -> tf2 :: (Type -> Type) -> ctx :: {Unit}
adamc@355 87 -> (nm :: Name -> t :: Type -> rest :: {Type}
adamc@355 88 -> fn [[nm] ~ rest] =>
adamc@355 89 tf1 t -> tf2 t -> xml ctx [] [])
adamc@355 90 -> r :: {Type}
adamc@355 91 -> $(mapTT tf1 r) -> $(mapTT tf2 r) -> xml ctx [] []
adamc@334 92
adamc@355 93 val foldT2RX2 : tf1 :: ((Type * Type) -> Type) -> tf2 :: ((Type * Type) -> Type)
adamc@355 94 -> ctx :: {Unit}
adamc@355 95 -> (nm :: Name -> t :: (Type * Type) -> rest :: {(Type * Type)}
adamc@355 96 -> fn [[nm] ~ rest] =>
adamc@355 97 tf1 t -> tf2 t -> xml ctx [] [])
adamc@355 98 -> r :: {(Type * Type)}
adamc@355 99 -> $(mapT2T tf1 r) -> $(mapT2T tf2 r) -> xml ctx [] []
adamc@339 100
adamc@334 101 val queryX : tables ::: {{Type}} -> exps ::: {Type} -> ctx ::: {Unit}
adamc@355 102 -> sql_query tables exps
adamc@355 103 -> fn [tables ~ exps] =>
adamc@355 104 ($(exps ++ fold (fn nm (fields :: {Type}) acc [[nm] ~ acc] =>
adamc@355 105 [nm = $fields] ++ acc) [] tables)
adamc@355 106 -> xml ctx [] [])
adamc@355 107 -> transaction (xml ctx [] [])
adamc@341 108
adamc@355 109 val oneOrNoRows : tables ::: {{Type}} -> exps ::: {Type}
adamc@355 110 -> sql_query tables exps
adamc@355 111 -> fn [tables ~ exps] =>
adamc@355 112 transaction
adamc@355 113 (option
adamc@355 114 $(exps
adamc@355 115 ++ fold (fn nm (fields :: {Type}) acc
adamc@355 116 [[nm] ~ acc] =>
adamc@355 117 [nm = $fields] ++ acc)
adamc@355 118 [] tables))