<font face="verdana,sans-serif">What if the strict code were to assume nothing is ever _|_, and result in &quot;undefined behavior&quot; if it is? Kind of like a NULL pointer in C.</font><div class="gmail_extra"><br><br><div class="gmail_quote">

On Tue, Nov 6, 2012 at 8:36 AM, Jan-Willem Maessen <span dir="ltr">&lt;<a href="mailto:jmaessen@alum.mit.edu" target="_blank">jmaessen@alum.mit.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="gmail_extra"><div class="gmail_quote"><div class="im">On Mon, Nov 5, 2012 at 5:52 PM, Johan Tibell <span dir="ltr">&lt;<a href="mailto:johan.tibell@gmail.com" target="_blank">johan.tibell@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>The tricky part is to define the semantics of this pragma in terms of Haskell, instead of in terms of Core. While we also need the latter, we cannot describe the feature to users in terms of Core. The hard part is to precisely define the semantics, especially in the presence of separate compilation (i.e. we might import lazy functions).</div>




<div><br></div><div>I&#39;d like to get the Haskell communities input on this. Here&#39;s a strawman:</div><div><br></div><div> * Every function application f _|_ = _|_, if f is defined in this module [1]. This also applies to data type constructors (i.e. the code acts if all fields are preceded by a bang).</div>




<div><br></div><div> * lets and where clauses act like (strict) case statements.</div></blockquote><div><br></div></div><div>What ordering constraints will exist on let and where clauses?  Is the compiler free to re-order them in dependency order?</div>


<div><br></div><div>Must they be strictly evaluated in the context in which they occur?  Haskell syntax readily lends itself to a style a bit like this:</div><div><br></div><div>f x y z</div><div>  | p x = ... a ... b</div>


<div>  | q y = ... a ... c</div><div>  | otherwise = ... d ...</div><div>  where a = ... </div><div>              b = ...</div><div>              c = ...</div><div>              d = ...</div><div><br></div><div>This tripped us up a lot in pH and Eager Haskell, where we at least wanted to be able to float d inwards and where it was sometimes surprising and costly if we missed the opportunity.  But that changes the semantics if d = _|_.  It&#39;s even worse if d = _|_ exactly when p x || q y.</div>


<div><br></div><div>Part of the answer, I&#39;m sure, is &quot;don&#39;t do that&quot;, but it might mean some code ends up surprisingly less readable than you&#39;d expect.</div><div class="im"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div> * It&#39;s still possible to define strict arguments, using &quot;~&quot;. In essence the Haskell lazy-by-default with opt-out via &quot;!&quot; is replaced with strict-by-default with opt-out via &quot;~&quot;.</div>




<div><br></div><div>Thoughts?</div></blockquote><div><br></div></div><div>I found myself wondering about free variables of lambdas, but realized that would be handled at the point where those variables are bound (the binding will either be strict or lazy).</div>

<span class="HOEnZb"><font color="#888888">
<div><br></div><div>-Jan</div><div><br></div></font></span></div></div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>