We present a gradually typed language, GrEff, with effects and handlers that supports migration from unchecked to checked effect typing. This serves as a simple model of the integration of an effect typing discipline with an existing effectful typed language that does not track fine-grained effect information. Our language supports a simple module system to model the programming model of gradual migration from unchecked to checked effect typing in the style of Typed Racket. The surface language GrEff is given semantics by elaboration to a core language Core GrEff. We equip Core GrEff with an inequational theory for reasoning about the semantic error ordering and desired program equivalences for programming with effects and handlers. We derive an operational semantics for the language from the equations provable in the theory. We then show that the theory is sound by constructing an operational logical relations model to prove the graduality theorem. This extends prior work on embedding-projection pair models of gradual typing to handle effect typing and subtyping.
翻译:逐步类型化的效应处理器
我们提出了一种逐步类型化的语言GrEff,带有效应和处理器,支持从未经检查的效应类型逐渐转换为已检查的效应类型。这是一个简单的模型,用于将效应类型学科与不跟踪细粒度效应信息的现有效应类型语言集成起来。我们的语言支持一个简单的模块系统,以Typed Racket的迁移方式来模拟逐步从未经检查的效应类型到已检查的效应类型。表面语言GrEff通过精确定义为核心语言Core GrEff提供语义。我们为对效应和处理器编程的所需程序等价的语义错误排序理论提供了一个不等式理论。我们从可以证明该理论的等式中导出了语言的操作语义。然后,我们通过构建一个操作逻辑关系模型来证明该理论是正确的,这扩展了先前的嵌入和投影双模型,用于处理效应类型和子类型。