[Haskell-cafe] small step evaluation as an unfold?
Steve Downey
sdowney at gmail.com
Tue Jan 23 22:25:27 EST 2007
(overall context - working through TaPL on my own, reimplemnting
typecheckers in haskell)
the type checkers all follow the same pattern, in ocaml they throw an
exception when the small step fails, which may mean taking another
branch in the eval, but that that sub expression has hit bottom.
it is self admittedly not good ocaml, and it seems to be even worse
haskell, as i try to extend the simple evaluator i have to deal with
managing reporting errors.
having the single small step evaluator return a Maybe is fairly close.
then the evaluator above it just bottoms out when eval1 expr returns
Nothing, by passing expr back up as the result.
but it occurs to me that it might be better to express it as an
unfold, where the result is a list with the last element as the
irresucible expression.
or am i insane / intoxicated ?
More information about the Haskell-Cafe
mailing list