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
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
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
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