<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>foldExp :: AlgExp a -> Exp -> a<br>foldExp alg (LitI i) = litI alg i
<br>foldExp alg (LitB i) = litB alg i<br>foldExp alg (add exp1 exp2) = żżż???<br>foldExp alg (and exp1 exp2) = żżż???<br>foldExp alg (ifte exp1 exp2 exp3) = żżż???<br></blockquote><br>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 has constructors named Add, And, and so on? Then you would want to do something like
<br><br>foldExp alg (Add exp1 exp2) = ???<br><br>and so on. For the ??? part, you want to pull out an appropriate function from your alg record and apply it to exp1 and exp2.<br><br>-Brent<br></div><br>