State monads don't respect the monad laws in Haskell

Hal Daume III hdaume@ISI.EDU
Tue, 14 May 2002 13:27:25 -0700 (PDT)


It's useful for:

debug :: Show a => a -> a
debug x = unsafePerformIO (hPutStrLn stderr (show x)) `seq` x

(Presumably "trace" is defined similarly)

One may ask the question: what is seq useful for not in conjunction with
unsafePerformIO, other than efficiency.  That, I don't know the answer to.

 - Hal

--
Hal Daume III

 "Computer science is no more about computers    | hdaume@isi.edu
  than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume

On Tue, 14 May 2002, Ken Shan wrote:

> On 2002-05-14T12:32:30-0400, Jan-Willem Maessen wrote:
> > And I'd really much rather we cleaned up the semantics of
> > seq---or better yet, fixed the problems with lazy evaluation which
> > make seq necessary in the first place.
> 
> A general question: What is seq useful for, other than efficiency?
> 
> -- 
> Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
> QUIET! Do you smell something?
>