【24h】

Handling Local State with Global State

机译:用全局状态处理本地状态

获取原文

摘要

Equational reasoning is one of the most important tools of functional programming. To facilitate its application to monadic programs, Gibbons and Hinze have proposed a simple axiomatic approach using laws that characterise the computational effects without exposing their implementation details. At the same time Plotkin and Pretnar have proposed algebraic effects and handlers, a mechanism of layered abstractions by which effects can be implemented in terms of other effects. This paper performs a case study that connects these two strands of research. We consider two ways in which the nondeterminism and state effects can interact: the high-level semantics where every nondeterministic branch has a local copy of the state, and the low-level semantics where a single sequentially threaded state is global to all branches. We give a monadic account of the folklore technique of handling local state in terms of global state, provide a novel axiomatic characterisation of global state and prove that the handler satisfies Gibbons and Hinze's local state axioms by means of a novel combination of free monads and contextual equivalence. We also provide a model for global state that is necessarily non-monadic.
机译:方程式推理是功能编程中最重要的工具之一。为了促进将其应用于单子程序,Gibbons和Hinze提出了一种简单的公理化方法,该方法使用了表征计算效果的定律而没有公开其实现细节。同时,Plotkin和Pretnar提出了代数效果和处理程序,这是一种分层抽象的机制,通过该机制可以根据其他效果来实现效果。本文进行了一个案例研究,将这两个研究环节联系在一起。我们考虑两种不确定性和状态效应可以交互的方式:每个非确定性分支都有状态的本地副本的高级语义,以及一个顺序线程状态对于所有分支都是全局的低级语义。我们从全球状态的角度对处理本地状态的民间传说技术进行了单子论的说明,提供了对全局状态的新颖公理化描述,并通过自由单子和上下文的新颖组合证明了处理程序满足了Gibbons和Hinze的本地状态公理。等价。我们还为全局状态提供了一个模型,该模型必须是非单态的。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号