[Haskell-cafe] Eval of a syntax tree for reduction

2006-03-27 Thread Steve Downey
I'm working through Pierce's Types and Programming Languages on my own. I'm attempting to write the typecheckers in Haskell, instead of ML. However, when it comes to his eval function, I'm a little stuck. The original is let rec eval t = try let t' = eval1 t in eval t' with NoRuleApplies - tWhere

Re: [Haskell-cafe] Eval of a syntax tree for reduction

2006-03-27 Thread Antti-Juhani Kaijanaho
Steve Downey wrote: It makes eval1 a bit more complicated, and not as straightforward translation from the type system being described, though. e.g reducing If looks more like eval1 (TmIfExpr t1 t2 t3) = let t1' = eval1 t1 in case t1' of { Just t1'' - Just $ TmIfExpr t1''

Re: [Haskell-cafe] Eval of a syntax tree for reduction

2006-03-27 Thread Greg Buchholz
Steve Downey wrote: ] I'm considering changing eval1 to be ArithExpr-Maybe ArithExpr ] ] If the expression is reducible, then I return Just t, and if it's not ] reducible, then Nothing ] ] It makes eval1 a bit more complicated, and not as straightforward ] translation from the type system being