<br><br><div class="gmail_quote">On Tue, May 7, 2013 at 6:38 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 dir="ltr">Hi,<div><br></div><div>All very good questions. Here&#39;s my current thinking on the matter:</div><div><br></div><div>`a` and `!a` are compatible types. The compiler will insert the `seq`s where needed. I don&#39;t think this is useless.</div>


<div><br></div><div>First, it serves as good documentation. Documenting strictness properties, e.g. as we do in the container library today, is awkward. Strictness annotations on types would make the documentation precise and succinct.</div>


<div><br></div><div>Second, it&#39;s a bit more declarative than having put manually put bang patterns at the right places in the function definition and having to remember (and teach beginners) how to do that correctly..</div>


<div><br></div><div>Third, it might help use generate better code, especially if we also implement Strict Core.</div></div></blockquote><div><br></div><div>Right. I completely agree. The idea is attractive to me for the same reasons. My questions basically relate to: how would you implement it?</div>
<div><br></div><div>Right now GHC&#39;s type checker works by solving type equality constraints. Type equality is symmetric, and implies that the two types are substitutable for each other in all contexts: there&#39;s no concept of &quot;mixing them up&quot;, because there&#39;s nothing to get mixed up, they are the same. But `a` and `!a` aren&#39;t like that. You very much want to avoid mixing them up, so you can insert `seq`s in the right places. But how would that mesh with the present system?</div>
<div><br></div><div>Would you allow strictness annotations on type arguments in arbitrary positions ([!Int] and so forth)? That leads to the issues regarding &quot;how could the compiler know how to strict-ify arbitrary types&quot;, and/or co/contra/invariance of type parameters.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>I believe this is analogous to what Scala does for their by-value parameters, which types are preceded with a =&gt; annotation.</div>
</div></blockquote><div><br></div><div>Looks like it&#39;s the reverse actually: <a href="http://stackoverflow.com/a/6297466">http://stackoverflow.com/a/6297466</a></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">

<div><br></div><div>Cheers,</div><div>Johan</div><div><br></div><div class="gmail_extra"><br></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Your ship was destroyed in a monadic eruption.