[commit: ghc] master: Note [HyperStr and Use demands] (cb17c1f)

git at git.haskell.org git at git.haskell.org
Mon Dec 2 19:17:37 UTC 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/cb17c1fd7d45f18029be8e8e5e07e4d8fc4f36a9/ghc

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

commit cb17c1fd7d45f18029be8e8e5e07e4d8fc4f36a9
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Mon Dec 2 18:03:52 2013 +0000

    Note [HyperStr and Use demands]
    
    This note is a summary of an explanation by SPJ to me.


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

cb17c1fd7d45f18029be8e8e5e07e4d8fc4f36a9
 compiler/basicTypes/Demand.lhs |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/compiler/basicTypes/Demand.lhs b/compiler/basicTypes/Demand.lhs
index 796c7cd..8afc4f8 100644
--- a/compiler/basicTypes/Demand.lhs
+++ b/compiler/basicTypes/Demand.lhs
@@ -86,6 +86,7 @@ import DataCon         ( splitDataProductType_maybe )
 data StrDmd
   = HyperStr             -- Hyper-strict 
                          -- Bottom of the lattice
+                         -- Note [HyperStr and Use demands]
 
   | SCall StrDmd         -- Call demand
                          -- Used only for values of function type
@@ -1451,6 +1452,19 @@ strictifyDictDmd ty dmd = case absd dmd of
   _ -> dmd -- unused or not a dictionary
 \end{code}
 
+Note [HyperStr and Use demands]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The information "HyperStr" needs to be in the strictness signature, and not in
+the demand signature, becuase we still want to know about the demand on things. Consider
+
+    f (x,y) True  = error (show x)
+    f (x,y) False = x+1
+
+The signature of f should be <S(SL),1*U(1*U(U),A)><S,1*U>m. If we were not
+distinguishing the uses on x and y in the True case, we could either not figure
+out how deeply we can unpack x, or that we do not have to pass y.
+
 
 %************************************************************************
 %*                                                                      *



More information about the ghc-commits mailing list