<div dir="ltr"><div dir="ltr"><div>Committee,</div><div><br></div><div>We have been asked to review <br><h2 id="gmail-:36g" class="gmail-hP" tabindex="-1">#313: Delimited continuation primops</h2></div><div> <a href="https://github.com/ghc-proposals/ghc-proposals/pull/313" rel="noreferrer" target="_blank">https://github.com/ghc-proposals/ghc-proposals/pull/313</a><br>
<a href="https://github.com/lexi-lambda/ghc-proposals/blob/delimited-continuation-primops/proposals/0000-delimited-continuation-primops.md" rel="noreferrer" target="_blank">https://github.com/lexi-lambda/ghc-proposals/blob/delimited-continuation-primops/proposals/0000-delimited-continuation-primops.md</a></div><div><br></div><div><b>Summary</b></div><div><br></div><div>The proposal makes no language changes, it only adds <a href="https://github.com/lexi-lambda/ghc-proposals/blob/delimited-continuation-primops/proposals/0000-delimited-continuation-primops.md#proposed-change-specification">three primops</a>.</div><div><br></div><div>The main motivation is to support building efficient implementations of Algebraic Effect systems, which depend on being able to efficiently capture a continuation. Currently this is done explicitly, which imposes a severe performance penalty.<br></div></div><div><br></div><div>These primops are the minimal support needed to be able to capture a continuation and apply it at runtime, together with some basic type safety via the PromtTag type to ensure that at least we don't replace a continuation with a computation of a different type. (there are other ways to go wrong with these primops though, they're not a safe interface by themselves: they need to be wrapped in a safe library).<br></div><div><br></div><div>The primops are implemented by copying chunks of stack into the heap. This is something that GHC's runtime already does a lot of, so it's not a new concept, although it does require a new closure type and knock-on changes across several files in the runtime (though it's mainly mechanical). There's a prototype implementation here: <a href="https://gitlab.haskell.org/lexi.lambda/ghc/-/compare/master...first-class-continuations?view=inline">https://gitlab.haskell.org/lexi.lambda/ghc/-/compare/master...first-class-continuations?view=inline</a></div><div><br></div><div><b>Decision</b></div><div><b><br></b></div><div>I'm going to tentatively recommend acceptance. </div><div><ul><li>This is a sensible choice for the primtives, being the most general of the alternatives, as <a href="https://github.com/lexi-lambda/ghc-proposals/blob/delimited-continuation-primops/proposals/0000-delimited-continuation-primops.md#operational-semantics">explained in the proposal.</a></li><li>Would the new primops impose a significant ongoing maintenance burden? Having looked at the patch, although there are some missing pieces, I don't think the new concepts impose any significant new requirements on other parts of the runtime.<br></li><li>I suspect there may be some difficulties around unsafePerformIO, so I <a href="https://github.com/ghc-proposals/ghc-proposals/pull/313#issuecomment-732181948">raised that on the github thread</a><br></li></ul></div><div>Thoughts?<br></div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><span style="font-family:arial,sans-serif"><br></span></div><div dir="ltr" class="gmail_attr"><span style="font-family:arial,sans-serif"><br></span></div><div dir="ltr" class="gmail_attr"><span style="font-family:arial,sans-serif"></span>On Sat, 12 Sep 2020 at 22:59, Joachim Breitner <<a href="mailto:mail@joachim-breitner.de">mail@joachim-breitner.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear Committee,<br>
<br>
this is your secretary speaking:<br>
<br>
Delimited continuation primops<br>
has been proposed by Alexis King<br>
<a href="https://github.com/ghc-proposals/ghc-proposals/pull/313" rel="noreferrer" target="_blank">https://github.com/ghc-proposals/ghc-proposals/pull/313</a><br>
<a href="https://github.com/lexi-lambda/ghc-proposals/blob/delimited-continuation-primops/proposals/0000-delimited-continuation-primops.md" rel="noreferrer" target="_blank">https://github.com/lexi-lambda/ghc-proposals/blob/delimited-continuation-primops/proposals/0000-delimited-continuation-primops.md</a><br>
<br>
I’ll propose Simon Marlow as the shepherd.<br>
<br>
Please guide us to a conclusion as outlined in <br>
<a href="https://github.com/ghc-proposals/ghc-proposals#committee-process" rel="noreferrer" target="_blank">https://github.com/ghc-proposals/ghc-proposals#committee-process</a><br>
<br>
Thanks,<br>
Joachim<br>
-- <br>
Joachim Breitner<br>
<a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a><br>
<a href="http://www.joachim-breitner.de/" rel="noreferrer" target="_blank">http://www.joachim-breitner.de/</a><br>
<br>
<br>
_______________________________________________<br>
ghc-steering-committee mailing list<br>
<a href="mailto:ghc-steering-committee@haskell.org" target="_blank">ghc-steering-committee@haskell.org</a><br>
<a href="https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee" rel="noreferrer" target="_blank">https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee</a><br>
</blockquote></div></div>