[commit: ghc] cardinality: defaulta demand for seq changed (c6c2149)

Ilya Sergey <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : cardinality

http://hackage.haskell.org/trac/ghc/changeset/c6c2149e4d1552f0a9929eb22136eadd8d50deda

>---------------------------------------------------------------

commit c6c2149e4d1552f0a9929eb22136eadd8d50deda
Author: Ilya Sergey <[email protected]>
Date:   Wed Sep 26 19:45:08 2012 +0100

    defaulta demand for seq changed

>---------------------------------------------------------------

 compiler/basicTypes/Demand.lhs  |   10 +++++++---
 compiler/prelude/primops.txt.pp |    2 +-
 compiler/stranal/DmdAnal.lhs    |    2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/compiler/basicTypes/Demand.lhs b/compiler/basicTypes/Demand.lhs
index 8e27004..c56f0c6 100644
--- a/compiler/basicTypes/Demand.lhs
+++ b/compiler/basicTypes/Demand.lhs
@@ -24,7 +24,7 @@ module Demand (
        
         seqStrDmd, seqStrDmdList, seqAbsDmd, seqAbsDmdList,
         seqDemand, seqDemandList, seqDmdType, seqStrictSig, 
-        evalDmd, onceEvalDmd, mkRhsDmd, isStrictDmd, splitCallDmd, splitDmdTy,
+        evalDmd, headDmd, onceEvalDmd, mkRhsDmd, isStrictDmd, splitCallDmd, splitDmdTy,
         someCompUsed, isUsed, isUsedDmd,
         defer, use, deferType, deferEnv, modifyEnv,
         isProdDmd, isPolyDmd, replicateDmd, splitProdDmd, peelCallDmd, mkCallDmd,
@@ -489,10 +489,14 @@ someCompUsed (UProd _ _) = True
 someCompUsed _           = False
 
 -- Evaluation demands
-evalDmd :: JointDmd
+evalDmd :: Demand
 evalDmd = mkJointDmd strStr top
 
-onceEvalDmd :: JointDmd
+-- A special demand for `seq`
+headDmd :: Demand
+headDmd = mkJointDmd strStr (UHead One)
+
+onceEvalDmd :: Demand
 onceEvalDmd = mkJointDmd strStr (Used One)
 
 defer :: Demand -> Demand
diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index 8446c20..8478177 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -2002,7 +2002,7 @@ section "Tag to enum stuff"
 primop  DataToTagOp "dataToTag#" GenPrimOp
    a -> Int#
    with
-   strictness  = { \ _arity -> mkStrictSig (mkTopDmdType [evalDmd] topRes) }
+   strictness  = { \ _arity -> mkStrictSig (mkTopDmdType [headDmd] topRes) }
 
 	-- dataToTag# must have an evaluated argument
 
diff --git a/compiler/stranal/DmdAnal.lhs b/compiler/stranal/DmdAnal.lhs
index 4dcf4ce..a237163 100644
--- a/compiler/stranal/DmdAnal.lhs
+++ b/compiler/stranal/DmdAnal.lhs
@@ -380,7 +380,7 @@ aggregating approach exhibits worse results because of the nature of
 |both| operation for strictness. Consider the example:
 
 f y c = 
-  let h x = y |seq| x
+  let h x = y `seq` x
    in case of 
         True  -> h True
         False -> y
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.