论文标题
统一分级和参数化的单子
Unifying graded and parameterised monads
论文作者
论文摘要
Monads是构建计算有效特征(例如状态,非确定性和延续)的有用工具。在过去的十年中,已经提出了几种单子概括,这些概括通过用索引的构造函数替换单型构造函数,从而提供了更精细的效果模型。最值得注意的是,渐变的单子(由单型索引)模型效应系统和参数化的单元(由成对的条件和后条件后的索引)模型程序逻辑。本文通过第三个概括研究了这两种单子概括之间的关系。我们称之为类别级别的单元的第三个概括是通过将单调视为特殊特殊情况的特殊情况来产生的。一个类别的单元为其他类别的形态f索引提供了一个功能因子家族。这允许排除某些效果的组成(以程序逻辑的样式)以及对效果的抽象描述(以效应系统的样式)。以此为基础,我们展示了如何将分级和参数化的单调统一,从而研究其在此过程中的相似性和差异。
Monads are a useful tool for structuring effectful features of computation such as state, non-determinism, and continuations. In the last decade, several generalisations of monads have been suggested which provide a more fine-grained model of effects by replacing the single type constructor of a monad with an indexed family of constructors. Most notably, graded monads (indexed by a monoid) model effect systems and parameterised monads (indexed by pairs of pre- and post-conditions) model program logics. This paper studies the relationship between these two generalisations of monads via a third generalisation. This third generalisation, which we call category-graded monads, arises by generalising a view of monads as a particular special case of lax functors. A category-graded monad provides a family of functors T f indexed by morphisms f of some other category. This allows certain compositions of effects to be ruled out (in the style of a program logic) as well as an abstract description of effects (in the style of an effect system). Using this as a basis, we show how graded and parameterised monads can be unified, studying their similarities and differences along the way.