[Haskell-cafe] Laziness and Either
malcolm.wallace at cs.york.ac.uk
Mon Apr 21 16:05:48 EDT 2008
> But when I did a simple
> refactoring to use Either, it occurred to me that this switch likely
> had a
> negative impact on laziness.
> 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-
The technique is explored in this paper about partial parsing:
More information about the Haskell-Cafe