annotate lib/top.urs @ 379:2b604ae76611

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