[Haskell-cafe] Laziness and Either

Donn Cave donn at avvanta.com
Mon Apr 21 14:40:45 EDT 2008

On Apr 21, 2008, at 11:18 AM, John Goerzen wrote:

> In the case of using "error", we can happily process the data assuming
> everything will be fine, and raise an error if and when it is  
> encountered.
> By using Either, however, any pattern match on the Left/Right  
> result is
> going to force the entire input to be evaluated so that we can know  
> whether
> or not it had any error.
> Is this analysis sensible?  If so, are there better solutions?

In another thread back on March 12 ("Exception handling when using  
I read `Since the decision between Left and Right requires all parts  
to be
evaluated, it's Either that might too strict for your application.  
What about
a writer monad, where exceptions, or better say warnings, are written  
to the
writer stream?'

I don't believe I ever got around to evaluating that recommendation  
evaluation strategy, indeed.)  I think I would use "error".

	Donn Cave, donn at u.washington.edu

More information about the Haskell-Cafe mailing list