oleg wrote:

> Sorry I didn't know of that requirement. The desired sharing 
> can easily be introduced:

That's always a risk with posting a toy example - which bits
are important can be hard to tell. You are right of course
about being able to introduce the sharing.

FWIW, after the suggestions that I've had (thanks!), my
"existential-free" example is as below.

Tim



type ColumnFn rowv = [rowv] -> ([String],String)

column :: (rowv->a) -> ([a]->a) -> (a->String) -> ColumnFn
column valf sumf fmtf rows = (map fmtf vals, (fmtf.sumf) vals)
    where vals = map valf rows

calculate :: [ColumnFn rowv] -> [rowv] -> ([String],String)
calculate cfs rows = [ cf rows | cf <- cfs ]


----

rows = ["I","wish","to","define","a","report"]

cols = [
    column id                          (\_ -> "") id,
    column length                      sum        show,
    column (\s -> length s * length s) maximum    show
    ]
:r
values = [ calculate rows col | col <- cols ] 
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to