[Haskell-cafe] Re: Control.Exception.evaluate - 'correct definition' not so correct

apfelmus apfelmus at quantentunnel.de
Wed May 7 07:35:40 EDT 2008


Abhay Parvate wrote:
> Just for curiocity, is there a practically useful computation that uses
> 'seq' in an essential manner, i.e. apart from the efficiency reasons?

I don't think so because you can always replace  seq  with  const id .
In fact, doing so will get you "more" results, i.e. a computation that
did not terminate may do so now.

In other words, we have

   seq _|_ = _|_
   seq x   = id    for  x > _|_

but

   (const id) _|_ = id
   (const id) x   = id   for  x > _|_

So, (const id) is always more defined (">") than  seq  .


For more about _|_ and the semantic approximation order, see

   http://en.wikibooks.org/wiki/Haskell/Denotational_semantics


Regards,
apfelmus




More information about the Haskell-Cafe mailing list