[Haskell-cafe] is value evaluated?

Sittampalam, Ganesh ganesh.sittampalam at credit-suisse.com
Sat May 9 15:50:08 EDT 2009

Brandon S. Allbery KF8NH wrote:
> On May 8, 2009, at 16:31 , Sittampalam, Ganesh wrote:
>> Brandon S. Allbery KF8NH wrote:
>>> Unless it catches exceptions itself (which strikes me as a bad idea;
>>> it becomes a trivial way to ignore exceptions, leading to bad
>>> programming practices) either they're handled inside the _|_ (in
>>> which case it isn't _|_ from the standpoint of our test) or in an
>>> outer scope (in which case our test produces _|_ from the standpoint
>>> of the exception handler).
>> Surely it just needs to inspect the thunk to decide whether it's _|_
>> or not, rather than entering it?
> The point is it can never be given a thunk that is _|_ because
> exception handling will have either converted it to a non-_|_ or
> shunted past the test.

You can set up a thunk in one place, enter it wrapped in a catch in
another place, and then inspect it in a third place, e.g. (somewhat

do let x = if 1==1 then error "foo" else 3
   y <- catch (evaluate x) (\_ -> 2)
   b <- isEvaluated x



 Please access the attached hyperlink for an important electronic communications disclaimer: 

More information about the Haskell-Cafe mailing list