
21 Apr
2008
21 Apr
'08
4:05 p.m.
But when I did a simple refactoring to use Either, it occurred to me that this switch likely had a negative impact on laziness.
Yes, probably.
Is this analysis sensible? If so, are there better solutions?
I notice that your Maybe-based code is written in a monadic style. If you also use Applicative Functors with an appropriately lazy instance for Maybe, you may be able to be both lazy (where needed) and strict (where needed) just by mixing and matching do-notation with apply- notation. The technique is explored in this paper about partial parsing: http://www-users.cs.york.ac.uk/~malcolm/partialparse.html Regards, Malcolm