Re: [Haskell-cafe] data declarations should provide fold functions

2009-01-10 Thread Johan Jeuring
I know the short-term answer is use TH to derive folds if I want them, but I think such an important concept should probably be part of the language. The fold function is an example of a generic program, which can be defined using generic programming libraries. Since the fold has to know about

[Haskell-cafe] data declarations should provide fold functions

2009-01-07 Thread Tim Newsham
I've had to use some fold functions recently and I've come to the conclusion that Haskell should automatically generate fold functions for data definitions. To clarify what I mean, for the data definition: data MyData = This Int Char | That String Int Int there should be a matching

Re: [Haskell-cafe] data declarations should provide fold functions

2009-01-07 Thread wren ng thornton
Tim Newsham wrote: I know the short-term answer is use TH to derive folds if I want them, but I think such an important concept should probably be part of the language. If you don't mind the hairy code, there's always this generic answer from #haskell almost a year ago: