<div dir="auto">Take a look at this PR:<div dir="auto"><br></div><div dir="auto"><a href="https://github.com/haskell/primitive/pull/109/files">https://github.com/haskell/primitive/pull/109/files</a><br></div><div dir="auto"><br></div><div dir="auto">The heterogeneous array creation functions I propose take rank-2 traversal functions as arguments and are therefore rank-3. In this case, the reason is a bit boring: the package in question can't depend on either (any?) of the packages offering rank-2 versions of Traversable.</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Apr 3, 2018, 6:37 AM Timotej Tomandl <<a href="mailto:timotomandl@gmail.com">timotomandl@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hello,<br><br></div><div>So we need rank-2 type in <a id="m_5337277759885455258gmail-v:runST" class="m_5337277759885455258gmail-def" rel="noreferrer">runST</a> :: (<span class="m_5337277759885455258gmail-keyword">forall</span> s. <a href="https://hackage.haskell.org/package/base-4.11.0.0/docs/Control-Monad-ST.html#t:ST" title="Control.Monad.ST" target="_blank" rel="noreferrer">ST</a> s a) -> a, to prevent s from appearing in a.<br></div><div><br>I have been thinking about this for a bit, but I failed to come up with a practical situation, where rank-3 types are necessary for safety of some abstraction.<br><br>The rank-3 example in here and any other I found, look very synthetic, i.e. limiting computation to id:<br><a href="https://ocharles.org.uk/blog/guest-posts/2014-12-18-rank-n-types.html" target="_blank" rel="noreferrer">https://ocharles.org.uk/blog/guest-posts/2014-12-18-rank-n-types.html</a><br></div><div>and compared to the runST example of limiting a scope of a type variable for purposes of safety looks unnatural.<br></div><div>Could anyone please point me to a practical example of rank-3 polymorphism, where it is necessary for safety of an abstraction, if it exists?<br><br></div><div>I suspect there is a situation, where rank-3 is necessary for maintaining abstration exists, but I can't think of any.<br></div><div>Any ideas about such situations and even better situations where this is used on hackage?<br></div><div><br></div><div>Timotej Tomandl<br></div></div>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div>