<div dir="auto"><div>IO and ST RealWorld are indeed represented the same--in today's GHC. It would be possible to implement the same ST interface differently (e.g., as an operational monad). Adding ioToST to the public interface commits not only GHC, but also future Haskell implementations, to a similar representation.</div><div dir="auto"><br></div><div dir="auto">Note: I recently noticed a real difference between IO and ST with regard to strictness analysis. In IO,</div><div dir="auto"><br></div><div dir="auto">m >>= undefined</div><div dir="auto"><br></div><div dir="auto">is *not* bottom: it may perform an observable action. In ST, it is bottom; anything it mutates is guaranteed to vanish in a puff of smoke.</div><div dir="auto"><br></div><div dir="auto">So assuming that these have the same representation actually introduces some complications for optimization.<br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On Jul 20, 2017 1:36 PM, "Andrew Martin" <<a href="mailto:andrew.thaddeus@gmail.com">andrew.thaddeus@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">My understanding is that `ST RealWorld` and `IO` are genuinely the same thing. But I'd want someone with better understanding to corroborate that claim.</div><div class="gmail_extra"><div class="elided-text"><br><div class="gmail_quote">On Thu, Jul 20, 2017 at 12:02 PM, David Feuer <span dir="ltr"><<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>This seems to commit to ST and IO really being the same. Does stToIO already make this commitment? I can't tell, but if not, I oppose making that commitment in the "public" interface.<br><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_-726654342589771454h5">On Jul 20, 2017 11:51 AM, "Andrew Martin" <<a href="mailto:andrew.thaddeus@gmail.com" target="_blank">andrew.thaddeus@gmail.com</a>> wrote:<br type="attribution"></div></div><blockquote class="m_-726654342589771454m_4074085373659683103quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-726654342589771454h5"><div dir="ltr">There's a function stToIO that is defined in <a href="http://GHC.IO" target="_blank">GHC.IO</a> and exported from <a href="http://Control.Monad.ST" target="_blank">Control.Monad.ST</a>. There's another function, ioToST, that's also defined in IO, but it isn't exported from <a href="http://Control.Monad.ST" target="_blank">Control.Monad.ST</a>. I propose that it be exported from <a href="http://Control.Monad.ST" target="_blank">Control.Monad.ST</a>.<font color="#888888"><br clear="all"><div><br></div>-- <br><div class="m_-726654342589771454m_4074085373659683103m_-3023969136509451901gmail_signature" data-smartmail="gmail_signature">-Andrew Thaddeus Martin</div>
</font></div>
<br></div></div>______________________________<wbr>_________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/libraries</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div><font color="#888888">-- <br><div class="m_-726654342589771454gmail_signature" data-smartmail="gmail_signature">-Andrew Thaddeus Martin</div>
</font></div>
</blockquote></div><br></div></div></div>