[Haskell-cafe] CPS versus Pattern Matching performance

Henning Thielemann lemming at henning-thielemann.de
Tue Jul 10 05:05:04 EDT 2007


On Tue, 10 Jul 2007, Donald Bruce Stewart wrote:

> lemming:
> >
> > On Tue, 10 Jul 2007, Tony Morris wrote:
> >
> > > Is your explanation specific to maybe? Or does that apply to all functions?
> > >
> > > Suppose the following function for lists:
> > >
> > > f :: [a] -> b -> (a -> [a] -> b) -> b
> > >
> > > ...instead of pattern matching [] and (x:xs)
> >
> > A foldr without recursion. I use such functions frequently in order to
> > hide constructors of a data type. Does this kind of functions has a common
> > name?
>
> They're catamorphisms:
>
>     Bool  - cond/if-then-else
>     Maybe - maybe
>     (,)   - uncurry
>     []    - foldr

The emphasis was on "without recursion". There is clearly only a
difference for lists. So is there a name for "fold without recursion"?


More information about the Haskell-Cafe mailing list