annotate demo/more/orm.urs @ 990:46803e668a89

Fix a de Bruijn index bug in map fusion
author Adam Chlipala <adamc@hcoop.net>
date Tue, 06 Oct 2009 10:15:26 -0400
parents 0bdc4d538f1c
children b132f8620a66
rev   line source
adamc@990 1 con link :: (Type * Type) -> Type
adamc@990 2 val noParent : t ::: Type -> link (t, unit)
adamc@987 3
adamc@990 4 con meta = fn col_parent :: (Type * Type) => {
adamc@990 5 Link : link col_parent,
adamc@990 6 Inj : sql_injectable col_parent.1
adamc@987 7 }
adamc@987 8
adamc@987 9 functor Table(M : sig
adamc@990 10 con cols :: {(Type * Type)}
adamc@987 11 val cols : $(map meta cols)
adamc@987 12 constraint [Id] ~ cols
adamc@987 13 val folder : folder cols
adamc@987 14 end) : sig
adamc@987 15 type id
adamc@990 16 type row' = $(map fst M.cols)
adamc@990 17 type row = $([Id = id] ++ map fst M.cols)
adamc@990 18
adamc@987 19 val inj : sql_injectable id
adamc@990 20 val id : meta (id, row)
adamc@987 21
adamc@990 22 val create : row' -> transaction row
adamc@988 23 val delete : row -> transaction unit
adamc@988 24 val save : row -> transaction unit
adamc@988 25 val lookup : id -> transaction (option row)
adamc@988 26 val list : transaction (list row)
adamc@989 27
adamc@989 28 con col :: Type -> Type
adamc@989 29 val idCol : col id
adamc@990 30 val cols : $(map (fn col_parent :: (Type * Type) =>
adamc@990 31 {Col : col col_parent.1,
adamc@990 32 Parent : row -> transaction (option col_parent.2)}) M.cols)
adamc@989 33
adamc@989 34 type filter
adamc@990 35 val find : filter -> transaction (option row)
adamc@989 36 val search : filter -> transaction (list row)
adamc@989 37
adamc@989 38 val eq : t ::: Type -> col t -> t -> filter
adamc@989 39 val ne : t ::: Type -> col t -> t -> filter
adamc@989 40 val lt : t ::: Type -> col t -> t -> filter
adamc@989 41 val le : t ::: Type -> col t -> t -> filter
adamc@989 42 val gt : t ::: Type -> col t -> t -> filter
adamc@989 43 val ge : t ::: Type -> col t -> t -> filter
adamc@989 44
adamc@989 45 val _and : filter -> filter -> filter
adamc@989 46 val or : filter -> filter -> filter
adamc@987 47 end