<div dir="ltr">On Thu, Oct 30, 2014 Jan Stolarek wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
2. First pass of full laziness is followed by floating in. At that stage we have not yet run the<br>
demand analysis and yet the code that does the floating-in checks whether a binder is one-shot<br>
(FloatIn.okToFloatInside called by FloatIn.fiExpr AnnLam case). This suggests that cardinality<br>
analysis is done earlier (but when?) and that demand analysis is not the same thing as<br>
cardinality analysis.<br>
</blockquote><div><br></div><div>If you're looking at super-recent code, that could be Joachim Breitner's work. He's exposed the one-shot stuff at the Haskell level with the experimental magic oneShot function, intended primarily for use in the libraries to make foldl-as-foldr and related things be analyzed more reliably. The old GHC arity analysis combined with his Call Arity get almost everything right, but there are occasional corner cases where things go wrong, and when they do the results tend to be extremely bad.<br></div></div></div></div>