+Instead of mt2, we have mt4. So now the type of "c" (a boxed string,
+type M[Char]) is the same as the type of the new shift operator, shift'.
+
+ shift' = \k.k(k"")
+
+This shift operator takes a continuation k of type [Char]->[Char], and
+invokes it twice. Since k requires an argument of type [Char], we
+need to use the first invocation of k to construction a [Char]; we do
+this by feeding it a string. Since the task does not replace the
+shift operator with any marker, we give the empty string "" as the
+argument.
+
+But now the new shift operator captures more than just the preceeding
+part of the construction---it captures the entire context, including
+the portion of the sequence that follows it. That is,
+
+ mt4 I = "ababdd"
+
+We have replaced "S" in "abSd" with "ab_d", where the underbar will be
+replaced with the empty string supplied in the definition of shift'.
+Crucially, not only is the prefix "ab" duplicated, so is the suffix
+"d".
+
+Things get interesting when we have more than one operator in the
+initial list. What should we expect if we start with "aScSe"?
+If we assume that when we evaluate each S, all the other S's become
+temporarily inert, we expect a reduction path like
+
+ aScSe ~~> aacSecSe
+
+But note that the output has just as many S's as the input--if that is
+what our reduction strategy delivers, then any initial string with
+more than one S will never reach a normal form.
+
+But that's not what the continuation operator shift' delivers.
+
+ mt5 = ⇧+ ¢ ⇧a ¢ (⇧+ ¢ shift' ¢ (⇧+ ¢ ⇧c ¢ (⇧+ ¢ shift' ¢ "e")))
+
+ mt5 I = "aacaceecaacaceecee" -- structure: "aacaceecaacaceecee"
+
+Huh?
+
+This is considerably harder to understand than the original list task.
+The key is figuring out in each case what function the argument k to
+the shift operator gets bound to.
+
+Let's go back to a simple one-shift example, "aSc". Let's trace what
+the shift' operator sees as its argument k by replacing ⇧ and ¢ with
+their definitions:
+
+ ⇧+ ¢ ⇧a ¢ (⇧+ ¢ shift' ¢ ⇧c) I
+ = \k.⇧+(\f.⇧a(\x.k(fx))) ¢ (⇧+ ¢ shift' ¢ ⇧c) I
+ = \k.(\k.⇧+(\f.⇧a(\x.k(fx))))(\f.(⇧+ ¢ shift' ¢ ⇧c)(\x.k(fx))) I
+ ~~> (\k.⇧+(\f.⇧a(\x.k(fx))))(\f.(⇧+ ¢ shift' ¢ ⇧c)(\x.I(fx)))
+ ~~> (\k.⇧+(\f.⇧a(\x.k(fx))))(\f.(⇧+ ¢ shift' ¢ ⇧c)(f))
+ ~~> ⇧+(\f.⇧a(\x.(\f.(⇧+ ¢ shift' ¢ ⇧c)(f))(fx))))
+ ~~> ⇧+(\f.⇧a(\x.(⇧+ ¢ shift' ¢ ⇧c)(fx)))
+ = (\k.k+)(\f.⇧a(\x.(⇧+ ¢ shift' ¢ ⇧c)(fx)))
+ ~~> ⇧a(\x.(⇧+ ¢ shift' ¢ ⇧c)(+x))
+ = (\k.ka)(\x.(⇧+ ¢ shift' ¢ ⇧c)(+x))
+ ~~> (⇧+ ¢ shift' ¢ ⇧c)(+a)
+ = (\k.⇧+(\f.shift(\x.k(fx)))) ¢ ⇧c (+a)
+ = (\k.(\k.⇧+(\f.shift(\x.k(fx))))(\f.⇧c(\x.k(fx))))(+a)
+ ~~> (\k.⇧+(\f.shift(\x.k(fx))))(\f'.⇧c(\x'.(+a)(f'x')))
+ ~~> ⇧+(\f.shift(\x.(\f'.⇧c(\x'.(+a)(f'x')))(fx)))
+ ~~> ⇧+(\f.shift(\x.⇧c(\x'.(+a)((fx)x'))))
+ = (\k.k+)(\f.shift(\x.⇧c(\x'.(+a)((fx)x'))))
+ ~~> shift(\x.⇧c(\x'.(+a)((+x)x'))))
+ = shift(\x.(\k.kc)(\x'.(+a)((+x)x'))))
+ ~~> shift(\x.(+a)((+x)c))
+
+So now we see what the argument of shift will be: a function k from
+strings x to the string asc. So shift k will be k(k "") = aacc.
+
+Ok, this is ridiculous. We need a way to get ahead of this deluge of
+lambda conversion. We'll adapt the notational strategy developed in
+Barker and Shan 2014:
+
+Instead of writing
+
+ \k.g(kf): (α -> ρ) -> ρ
+
+we'll write
+
+ g[] ρ
+ --- : ---
+ f α
+
+Then
+ []
+ mid(x) = --
+ x
+
+and
+
+ g[] ρ h[] ρ g[h[]] ρ
+ --- : ---- ¢ --- : --- = ------ : ---
+ f α->β x α fx β
+
+Here's the justification:
+
+ (\FXk.F(\f.X(\x.k(fx)))) (\k.g(kf)) (\k.h(kx))
+ ~~> (\Xk.(\k.g(kf))(\f.X(\x.k(fx)))) (\k.h(kx))
+ ~~> \k.(\k.g(kf))(\f.(\k.h(kx))(\x.k(fx)))
+ ~~> \k.g((\f.(\k.h(kx))(\x.k(fx)))f)
+ ~~> \k.g((\k.h(kx))(\x.k(fx)))
+ ~~> \k.g(h(\x.k(fx))x)
+ ~~> \k.g(h(k(fx)))
+
+Then
+ (\ks.k(ks))[]
+ shift = \k.k(k("")) = -------------
+ ""
+
+Let 2 == \ks.k(ks).
+
+so aSc lifted into the monad is
+
+ [] 2[] []
+ -- ¢ ( --- ¢ --- ) =
+ a "" c