A new kind of Continuation-like Monad?

It looks like Select where the computation returns both the “selected” value a and the “score” s. Indeed, this is a monad morphism:

morph :: S s a -> SC s a
morph (S f) = SC f (\k -> k (f k))

(Coq proof of the monad morphism laws)

One way SC could be more expressive than S is by having computations not expressible as morph f for some f :: S s a. It’s not difficult to come up with artificial examples, but perhaps there are more natural examples to adapt from the paper(s) on the selection monad.

4 Likes