[project @ 2001-09-14 15:49:56 by simonpj]
authorsimonpj <unknown>
Fri, 14 Sep 2001 15:49:56 +0000 (15:49 +0000)
committersimonpj <unknown>
Fri, 14 Sep 2001 15:49:56 +0000 (15:49 +0000)
commit74a395c2cd036a82a17b3a6f3d33477ebadb66c2
tree6bbf13484792a813b6545c6c757aee24c15602ee
parentfd4b0e845bd83be9eaf050b113f8df51cee6b082
[project @ 2001-09-14 15:49:56 by simonpj]
-----------------
Make seq built in
-----------------

DO NOT merge with stable

Until this commit 'seq' used a cunning hack so that it
seems to be *non-strict* in its second argument:

  seq x y = case seq# x of { 0 -> y; other -> error "urk" }

The reason for this is to make sure that x is evaluated before y,
which is what you want in a parallel setting.

But in a *sequential* settting, this simply destroys strictness
information about y.  Now that people are starting to use seq more,
this is becoming painful.  People sometimes use seq to make their
function strict, and are surprised when it becomes non-strict in other
arguments!

So this commit changes seq so that it does what you would naively
expect:

seq x y = case x of { any -> y }

This is done by making seq built-in, defined along with
unsafeCoerce
getTag

in MkId.lhs.  (I considered giving their unfoldings in
PrelGHC.hi-boot.pp, but then there is the matter of making sure they
are unfolded, since these fns don't have top-level curried defns,
so I held off and did seq the same way as the other two.)

I renamed PrelConc.seq as PrelConc.pseq; maybe its name will change
to `then` or `before` or something else.  That's up to the GPH
folk.
ghc/compiler/basicTypes/MkId.lhs
ghc/compiler/prelude/PrelNames.lhs
ghc/lib/std/PrelConc.lhs
ghc/lib/std/PrelGHC.hi-boot.pp