[Haskell-cafe] Re: ANNOUNCE: GotoT-transformers version 1.0

oleg at okmij.org oleg at okmij.org
Thu Sep 9 03:45:26 EDT 2010

Antoine Latter wrote:
> To recover from my overly complex previous post, here is a much simply
> goto based on existing monad transformers:

> > goto :: Monad m => ContT r m r -> ContT r m a
> > goto (ContT m) = ContT $ \_ ->
> >                m return

That is precisely how continuations were discovered (as John Reynolds
documents, continuations have been discovered and rediscovered
multiple times). The paper

  Continuations: A Mathematical Semantics for Handling Full Jumps
  Christopher Strachey and Christopher P. Wadsworth
  first published in 1974 and republished in
  Higher-Order and Symbolic Computation, 13, 135-152, 2000

starts with the following sentence:
    The purpose of this paper is to explain a method of giving the
    mathematical semantics of a programming language which includes a very
    general form of jump (goto statement).

The cited goto expression above appears, in mathematical notation, as
the second equation on p. 143 of the paper. Labels are considered
next.  The paper is still a good read. One can literally implement the
language of the paper, by reading domain equations as the
implementation of a monad.

Incidentally, Note 1 of the paper anticipated delimited continuations.

More information about the Haskell-Cafe mailing list