view demo/more/grid.urs @ 935:2422360c78a3

Dropped in initial aggregate types
author Adam Chlipala <adamc@hcoop.net>
date Tue, 15 Sep 2009 09:40:51 -0400
parents 5e8b6fa5b48f
children 6966d98c80b5
line wrap: on
line source
con colMeta' = fn (row :: Type) (t :: Type) =>
                  {Header : string,
                   Project : row -> transaction t,
                   Update : row -> t -> transaction row,
                   Display : t -> xbody,
                   Edit : t -> xbody,
                   Validate : t -> signal bool}
                  
con colMeta = fn (row :: Type) (global_t :: (Type * Type)) =>
                 {Initialize : transaction global_t.1,
                  Handlers : global_t.1 -> colMeta' row global_t.2}

con aggregateMeta = fn (row :: Type) (acc :: Type) =>
                       {Initial : acc,
                        Step : row -> acc -> acc,
                        Display : acc -> xbody}

functor Make(M : sig
                 type row
                 val list : transaction (list row)
                 val new : transaction row
                 val save : {Old : row, New : row} -> transaction unit
                 val delete : row -> transaction unit

                 con cols :: {(Type * Type)}
                 val cols : $(map (colMeta row) cols)

                 val folder : folder cols

                 con aggregates :: {Type}
                 val aggregates : $(map (aggregateMeta row) aggregates)
             end) : sig
    type grid

    val grid : transaction grid
    val sync : grid -> transaction unit
    val render : grid -> xbody
                           
    style tabl
    style tr
    style th
    style td
end