annotate lib/top.urs @ 346:a94a79820d49

Small clean-ups in crud; Compiler.check
author Adam Chlipala <adamc@hcoop.net>
date Sat, 04 Oct 2008 15:54:03 -0400
parents b85e6ba56618
children fa2d25fe75ce
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@325 6 con mapTT = fn f :: Type -> Type => fold (fn nm t acc => [nm] ~ acc =>
adamc@325 7 [nm = f t] ++ acc) []
adamc@325 8
adamc@339 9 con mapT2T = fn f :: (Type * Type) -> Type => fold (fn nm t acc => [nm] ~ acc =>
adamc@339 10 [nm = f t] ++ acc) []
adamc@339 11
adamc@339 12 con ex = fn tf :: (Type -> Type) =>
adamc@339 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@325 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@325 21 -> xml ctx use []
adamc@329 22
adamc@336 23 val foldTR : tf :: (Type -> Type) -> tr :: ({Type} -> Type)
adamc@336 24 -> (nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest
adamc@345 25 => tf t -> tr rest -> tr ([nm = t] ++ rest))
adamc@336 26 -> tr [] -> r :: {Type} -> $(mapTT tf r) -> tr r
adamc@336 27
adamc@339 28 val foldT2R : tf :: ((Type * Type) -> Type) -> tr :: ({(Type * Type)} -> Type)
adamc@339 29 -> (nm :: Name -> t :: (Type * Type) -> rest :: {(Type * Type)} -> [nm] ~ rest
adamc@345 30 => tf t -> tr rest -> tr ([nm = t] ++ rest))
adamc@339 31 -> tr [] -> r :: {(Type * Type)} -> $(mapT2T tf r) -> tr r
adamc@339 32
adamc@329 33 val foldTR2 : tf1 :: (Type -> Type) -> tf2 :: (Type -> Type) -> tr :: ({Type} -> Type)
adamc@329 34 -> (nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest
adamc@345 35 => tf1 t -> tf2 t -> tr rest -> tr ([nm = t] ++ rest))
adamc@329 36 -> tr [] -> r :: {Type} -> $(mapTT tf1 r) -> $(mapTT tf2 r) -> tr r
adamc@332 37
adamc@339 38 val foldT2R2 : tf1 :: ((Type * Type) -> Type) -> tf2 :: ((Type * Type) -> Type)
adamc@339 39 -> tr :: ({(Type * Type)} -> Type)
adamc@339 40 -> (nm :: Name -> t :: (Type * Type) -> rest :: {(Type * Type)} -> [nm] ~ rest
adamc@345 41 => tf1 t -> tf2 t -> tr rest -> tr ([nm = t] ++ rest))
adamc@339 42 -> tr [] -> r :: {(Type * Type)} -> $(mapT2T tf1 r) -> $(mapT2T tf2 r) -> tr r
adamc@339 43
adamc@336 44 val foldTRX : tf :: (Type -> Type) -> ctx :: {Unit}
adamc@336 45 -> (nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest
adamc@345 46 => tf t -> xml ctx [] [])
adamc@336 47 -> r :: {Type} -> $(mapTT tf r) -> xml ctx [] []
adamc@336 48
adamc@339 49 val foldT2RX : tf :: ((Type * Type) -> Type) -> ctx :: {Unit}
adamc@339 50 -> (nm :: Name -> t :: (Type * Type) -> rest :: {(Type * Type)} -> [nm] ~ rest
adamc@345 51 => tf t -> xml ctx [] [])
adamc@339 52 -> r :: {(Type * Type)} -> $(mapT2T tf r) -> xml ctx [] []
adamc@339 53
adamc@332 54 val foldTRX2 : tf1 :: (Type -> Type) -> tf2 :: (Type -> Type) -> ctx :: {Unit}
adamc@332 55 -> (nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest
adamc@345 56 => tf1 t -> tf2 t -> xml ctx [] [])
adamc@332 57 -> r :: {Type} -> $(mapTT tf1 r) -> $(mapTT tf2 r) -> xml ctx [] []
adamc@334 58
adamc@339 59 val foldT2RX2 : tf1 :: ((Type * Type) -> Type) -> tf2 :: ((Type * Type) -> Type) -> ctx :: {Unit}
adamc@339 60 -> (nm :: Name -> t :: (Type * Type) -> rest :: {(Type * Type)} -> [nm] ~ rest
adamc@345 61 => tf1 t -> tf2 t -> xml ctx [] [])
adamc@339 62 -> r :: {(Type * Type)} -> $(mapT2T tf1 r) -> $(mapT2T tf2 r) -> xml ctx [] []
adamc@339 63
adamc@334 64 val queryX : tables ::: {{Type}} -> exps ::: {Type} -> ctx ::: {Unit}
adamc@334 65 -> sql_query tables exps -> tables ~ exps
adamc@345 66 => ($(exps ++ fold (fn nm (fields :: {Type}) acc => [nm] ~ acc => [nm = $fields] ++ acc) [] tables)
adamc@334 67 -> xml ctx [] [])
adamc@334 68 -> transaction (xml ctx [] [])
adamc@341 69
adamc@341 70 val oneOrNoRows : tables ::: {{Type}} -> exps ::: {Type} -> sql_query tables exps
adamc@341 71 -> tables ~ exps
adamc@345 72 => transaction
adamc@341 73 (option $(exps ++ fold (fn nm (fields :: {Type}) acc => [nm] ~ acc => [nm = $fields] ++ acc) [] tables))