adamc@993: open Versioned.Make(struct adamc@993: con key = [Id = int] adamc@993: con data = [Nam = string, ShoeSize = int] adamc@993: adamc@993: val key = {Id = _} adamc@993: val data = {Nam = {Inj = _, adamc@993: Eq = _}, adamc@993: ShoeSize = {Inj = _, adamc@993: Eq = _}} adamc@993: end) adamc@993: adamc@995: fun retro vr = adamc@995: ks <- keysAt vr; adamc@995: ks <- List.mapM (fn r => fso <- archive vr r; return (r.Id, fso)) ks; adamc@995: adamc@995: return adamc@995: {List.mapX (fn (k, r) => adamc@995: {[k]}: {case r of adamc@995: None => Whoa! adamc@995: | Some r => {[r.Nam]}, {[r.ShoeSize]}} adamc@995: ) ks} adamc@995: adamc@995: adamc@993: fun expandKey k = adamc@993: name <- source ""; adamc@993: shoeSize <- source ""; adamc@993: return {Key = k, Nam = name, ShoeSize = shoeSize} adamc@993: adamc@993: fun main () = adamc@993: ks0 <- keys; adamc@993: ks0 <- List.mapM (fn r => expandKey r.Id) ks0; adamc@993: ks <- source ks0; adamc@993: adamc@993: id <- source ""; adamc@993: name <- source ""; adamc@993: shoeSize <- source ""; adamc@993: adamc@995: times <- updateTimes; adamc@995: adamc@993: return adamc@993: adamc@993: {[kr.Key]}: adamc@993: adamc@993: adamc@993: alert "Can't get it!" adamc@993: | Some r => adamc@993: set kr.Nam r.Nam; adamc@993: set kr.ShoeSize (show r.ShoeSize)}/> adamc@993: adamc@993: ) ks)}/> adamc@993: adamc@993: Add one: adamc@993: adamc@993: adamc@993: Id: adamc@993: Name: adamc@993: Shoe size: adamc@993: adamc@993: adamc@995: adamc@995: Archive adamc@995: adamc@995: {List.mapX (fn (vr, tm) => {[tm]}) times} adamc@993: