Re: [Haskell-cafe] foild function for expressions

2007-12-04 Thread Carlo Vivari
Yes,as I said before to other of you the exp data type was also declared in the exercise (my fault not to say it), and look as this: data Exp = LitI Int |LitB Bool |Add Exp Exp |And Exp Exp |If Exp Exp Exp -- View this message in

Re: [Haskell-cafe] foild function for expressions

2007-12-04 Thread Carlo Vivari
Brent Yorgey wrote: > > > One comment: it looks like (add exp1 exp2), (and exp1 exp2) and so on > above > are not correct. The second argument of foldExp is a value of type Exp, > so > you are pattern-matching on the constructors of Exp, and constructors are > always uppercase. Perhaps Exp h

[Haskell-cafe] foild function for expressions

2007-12-03 Thread Carlo Vivari
Hi! I'm a begginer in haskell and I have a problem with an exercise, I expect someone could help me: In one hand I have a declaration of an algebra data, like this: data AlgExp a = AlgExp { litI :: Int -> a, litB :: Bool -> a, add :: a -> a -> a, and :: a -> a -> a, ifte :: a -> a -