Re: Proposal: add replay function to Control.Monad.Cont.Class

Tom Ellis <[email protected]>
Newsgroups gmane.comp.lang.haskell.libraries
Message-ID <20210307092518.GD5518@cloudinit-builder>
On Sun, Mar 07, 2021 at 03:25:16AM +0000, Alexandre Esteves wrote:
> replay :: MonadCont m => m (m a)
> replay = callCC $ pure . fix
> 
> Using this in a do-notation block allows one to bind a name to the
> sub-block that starts immediately after.
> I reached for continuations to try to get this behavior for use with
> recursive flows without disrupting the reading of the main forward flow and
> found how to do it in https://jsdw.me/posts/haskell-cont-monad/ under the
> name "goto".
> 
> While "goto" is as familiar as a name can be, I feel "replay" more
> accurately conveys, that you can only 'go back', by stating what actually
> is happening - that a sub-block we're currently evaluating is replayed from
> its beginning.

Looks like a "label" more than a "goto" to me.  Would "label" be a
good name?
_______________________________________________
Libraries mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.