Skip to content
Snippets Groups Projects
Commit cb17c1fd authored by Joachim Breitner's avatar Joachim Breitner
Browse files

Note [HyperStr and Use demands]

This note is a summary of an explanation by SPJ to me.
parent 90588c1f
No related merge requests found
...@@ -86,6 +86,7 @@ import DataCon ( splitDataProductType_maybe ) ...@@ -86,6 +86,7 @@ import DataCon ( splitDataProductType_maybe )
data StrDmd data StrDmd
= HyperStr -- Hyper-strict = HyperStr -- Hyper-strict
-- Bottom of the lattice -- Bottom of the lattice
-- Note [HyperStr and Use demands]
| SCall StrDmd -- Call demand | SCall StrDmd -- Call demand
-- Used only for values of function type -- Used only for values of function type
...@@ -1451,6 +1452,19 @@ strictifyDictDmd ty dmd = case absd dmd of ...@@ -1451,6 +1452,19 @@ strictifyDictDmd ty dmd = case absd dmd of
_ -> dmd -- unused or not a dictionary _ -> dmd -- unused or not a dictionary
\end{code} \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.
%************************************************************************ %************************************************************************
%* * %* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment