[Haskell-cafe] Expressing seq
Jason Dagit
dagit at eecs.oregonstate.edu
Wed Sep 27 18:02:06 EDT 2006
On 9/27/06, Chad Scherrer <chad.scherrer at gmail.com> wrote:
> 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?
What if the types are not instances of Eq?
Jason
More information about the Haskell-Cafe
mailing list