一句话:提出带选择续延的代数效应处理器,使程序员能实现感知损失的选择操作,并给出λC语言的操作/指称语义与Haskell实现。
本文研究如何让程序员自定义选择操作,而非仅由选择单子给出最优选择。Abadi 与 Plotkin 曾用选择单子建模带损失感知的选择语言,但其选择是最优的,并留下程序员提供选择的问题。作者提出一种新设计:在代数效应处理器中,除定界续延外还加入选择续延,使操作可访问未来可能损失,从而实现感知损失的优化算法。文章为高阶模型语言 λC 给出操作语义,证明进展、类型可靠性和在带温和层级约束的操作类型子集上的终止性;并为该子集给出选择单子指称语义,证明可靠性与充分性。还提供 Haskell 实现和多个编程实例。
The selection monad on a set consists of selection functions. These select an element from the set, based on a loss (dually, reward) function giving the loss resulting from a choice of an element. Abadi and Plotkin used the monad to model a language with operations making choices of computations taking account of the loss that would arise from each choice. However, their choices were optimal, and they asked if they could instead be programmer provided. In this work, we present a novel design enabling programmers to do so. We present a version of algebraic effect handlers enriched by computational ideas inspired by the selection monad. Specifically, as well as the usual delimited continuations, our new kind of handlers additionally have access to choice continuations , that give the possible future losses. In this way programmers can write operations implementing optimisation algorithms that are aware of the losses arising from their possible choices. We give an operational semantics for a higher-order model language λC , and establish desirable properties including progress, type soundness, and termination for a subset with a mild hierarchical constraint on allowable operation types. We give this subset a selection monad denotational semantics, and prove soundness and adequacy results. We also present a Haskell implementation and give a variety of programming examples.