Skip to content
  • Simon Peyton Jones's avatar
    [project @ 2001-09-14 15:49:56 by simonpj] · 74a395c2
    Simon Peyton Jones authored
    -----------------
    	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.
    74a395c2