[Haskell-cafe] Expressing seq

Chad Scherrer chad.scherrer at gmail.com
Wed Sep 27 17:47:44 EDT 2006


I was reading on p. 29 of "A History of Haskell" (a great read, by the
way) about the controversy of adding seq to the language. But other
than for efficiency reasons, is there really any new primitive that
needs to be added to support this?

As long as the compiler doesn't optimize it away, why not just do
something like this (in ghci)?

Prelude> let sq x y = if x == x then y else y
Prelude> 1 `sq` 2
2
Prelude> (length [1..]) `sq` 2
Interrupted.

There must be a subtlety I'm missing, right?
-- 

Chad Scherrer

"Time flies like an arrow; fruit flies like a banana" -- Groucho Marx


More information about the Haskell-Cafe mailing list