Re: [Haskell-cafe] Re: Church Encoding Function

2007-03-12 Thread Derek Elkins
Joachim Breitner wrote: Hi, Am Samstag, den 10.03.2007, 14:52 -0500 schrieb Stefan Monnier: I'm pretty sure you can define a catamorphism for any regular algebraic data type. Actually, so-called negative occurrences in (regular) data types cause problems. Try to define the catamorphism of

Re: [Haskell-cafe] Re: Church Encoding Function

2007-03-11 Thread Joachim Breitner
Hi, Am Samstag, den 10.03.2007, 14:52 -0500 schrieb Stefan Monnier: I'm pretty sure you can define a catamorphism for any regular algebraic data type. Actually, so-called negative occurrences in (regular) data types cause problems. Try to define the catamorphism of data Exp = Num

Re: [Haskell-cafe] Re: Church Encoding Function

2007-03-11 Thread Lennart Augustsson
When you make these kind of elimination functions you have a choice. Namely if you want to do case analysis only, or primitive recursion. For non-recursive data types they come out the same, so 'maybe', 'either', 'uncurry', etc are the same. But for lists it differs: -- Case analysis

[Haskell-cafe] Re: Church Encoding Function

2007-03-10 Thread Stefan Monnier
I'm pretty sure you can define a catamorphism for any regular algebraic data type. Actually, so-called negative occurrences in (regular) data types cause problems. Try to define the catamorphism of data Exp = Num Int | Lam (Exp - Exp) | App Exp Exp to see the problem, Stefan