<div dir="auto">If you hide the usages of callCC behind a sound API then it shouldn't be much of an issue, if that's what you're saying.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 1 Sep 2021, 6:32 pm YueCompl, <<a href="mailto:compl.yue@icloud.com">compl.yue@icloud.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">Am I understanding it right that all ways upward since the monad layer (assuming all laws are strictly followed) of "Continuation monad", the programmer is restricted to "structured programming" practices, unless he/she resort to the continuation mechanism beneath the monad layer, only in where `goto` is available?<div><br></div><div>I think I can relax if that's the case, CPS is inevitable in this case of mine, and I can at least hide its unsafety beneath the Continuation monad from junior developers in my team.<br><div><br><blockquote type="cite"><div>On 2021-09-01, at 15:55, Isaac Elliott <<a href="mailto:isaace71295@gmail.com" target="_blank" rel="noreferrer">isaace71295@gmail.com</a>> wrote:</div><br><div><div dir="auto">I don't have any examples. Given that Cont essentially implements unstructured control flow, I think that examples of `goto` misuse would apply by analogy.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 1 Sep 2021, 4:31 pm YueCompl via Haskell-Cafe, <<a href="mailto:haskell-cafe@haskell.org" target="_blank" rel="noreferrer">haskell-cafe@haskell.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">I can understand the purpose if it is advising against overusing surface syntax in CPS, but here the approach is to hide continuation beneath the beloved do notation on the surface, and monad laws plus possibly further laws to be added, will make it safer to program programs by end programmers. <div><br></div><div>I do realize CPS is powerful yet dangerous (unsafe), abuse of CPS could be easy and quite unintentional, but what about abuse of "Continuation monad"?<br><div><br><blockquote type="cite"><div>On 2021-08-31, at 22:46, Jeff Clites via Haskell-Cafe <<a href="mailto:haskell-cafe@haskell.org" rel="noreferrer noreferrer" target="_blank">haskell-cafe@haskell.org</a>> wrote:</div><br><div><div dir="auto"><div></div><div>Based on the preceding paragraph, I think that by “abuse” it means overuse, as in using CPS when you could have used straightforward code. I can imagine someone doing at the source code level the sort of things that would be done by a CPS-based compiler (converting everything possible to CPS), and ending up with a mess.</div><div><br></div><div>For example, imagine you started with this code snippet:</div><div><br></div><div>  let x = f a</div><div>        y = g x</div><div>  in h x y</div><div><br></div><div>If you fully convert that to CPS you’d end up with 3 continuations (I think) and it would be much harder to understand. And adding an additional let binding later might involve a bunch of restructuring.</div><div><br></div><div>I assume it just means that sort of thing. When someone first learns about continuations and their generality, it can be tempting to go overboard.</div><div><br></div><div>Jeff</div><div><br>On Aug 31, 2021, at 3:03 AM, YueCompl via Haskell-Cafe <<a href="mailto:haskell-cafe@haskell.org" rel="noreferrer noreferrer" target="_blank">haskell-cafe@haskell.org</a>> wrote:<br><br></div><blockquote type="cite"><div>Dear Cafe,<div><br></div><div>I'm wrapping up my CPS codebase to provide some monadic interface, it appears almost the Cont monad, so the following statement is a pretty valid caveat to me now:<br><div><br></div><div>> <span style="color:rgb(232,230,227);font-family:sans-serif;font-size:13px;font-variant-ligatures:normal;background-color:rgb(24,26,27)">Abuse of the Continuation monad can produce code that is impossible to understand and maintain.</span><br><div><br></div><div>Which can be viewed in context of Hackage at: <a href="https://hackage.haskell.org/package/mtl/docs/Control-Monad-Cont.html#:~:text=Abuse%20of%20the%20Continuation%20monad%20can%20produce%20code%20that%20is%20impossible%20to%20understand%20and%20maintain" rel="noreferrer noreferrer" target="_blank">https://hackage.haskell.org/package/mtl/docs/Control-Monad-Cont.html#:~:text=Abuse%20of%20the%20Continuation%20monad%20can%20produce%20code%20that%20is%20impossible%20to%20understand%20and%20maintain</a> </div><div><br></div><div>But I can't find concrete examples demonstrating the "impossible to understand and maintain" situation, in figuring out what pitfalls I'd rather to avoid.</div><div><br></div><div>Please share what you know about it, many appreciations!</div><div><br></div><div>Background of my CPS necessarity: </div><div><br></div><div>Library code need to delegate STM transaction boundary delimitation to (scripting) application code, though `inlineSTM :: STM a -> m a` can be used to force some action to be within current tx, the usual `>>=` binding should honor whether a separate `atomically` tx should be issued for its rhs computation, as specified by the scripting context.</div><div><br></div><div>Thanks,</div><div>Compl</div><div><br></div></div></div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Haskell-Cafe mailing list</span><br><span>To (un)subscribe, modify options or view archives go to:</span><br><span><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></span><br><span>Only members subscribed via the mailman list are allowed to post.</span></div></blockquote></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.</div></blockquote></div><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 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>
</div></blockquote></div><br></div></div></blockquote></div>