首页> 外文会议>ACM SIGPLAN International Conference on Functional Programming >Attribute Grammars Fly First-Class How to do Aspect Oriented Programming in Haskell
【24h】

Attribute Grammars Fly First-Class How to do Aspect Oriented Programming in Haskell

机译:属性语法飞一堂课如何在Haskell做方面面向方面的编程

获取原文

摘要

Attribute Grammars (AGs), a general-purpose formalism for de-scribing recursive computations over data types, avoid the trade-off which arises when building software incrementally: should it be easy to add new data types and data type alternatives or to add new operations on existing data types? However, AGs are usually im-plemented as a pre-processor, leaving e.g. type checking to later processing phases and making interactive development, proper er-ror reporting and debugging difficult. Embedding AG into Haskell as a combinator library solves these problems. Previous attempts at embedding AGs as a domain-specific language were based on extensible records and thus exploiting Haskell's type system to check the well-formedness of the AG, but fell short in compactness and the possibility to abstract over oft oc-curring AG patterns. Other attempts used a very generic mapping for which the AG well-formedness could not be statically checked. We present a typed embedding of AG in Haskell satisfying all these requirements. The key lies in using HList-like typed heteroge-neous collections (extensible polymorphic records) and expressing AG well-formedness conditions as type-level predicates (i.e., type-class constraints). By further type-level programming we can also express common programming patterns, corresponding to the typ-ical use cases of monads such as Reader, Writer and State. The paper presents a realistic example of type-class-based type-level programming in Haskell.
机译:属性语法(AGS),用于通过数据类型解除递归计算的通用形式主义,避免在逐步构建软件时出现的权衡:是否易于添加新的数据类型和数据类型替代或添加新的现有数据类型的操作?然而,AGS通常被适用为预处理,离开时。键入稍后处理阶段并进行交互式开发,正确的ER-ROR报告和调试困难。将AG嵌入到HASKELL作为组合库库解决这些问题。以前的尝试嵌入AGS作为特定于域的语言,基于可扩展的记录,从而利用Haskell的类型系统来检查AG的良好形成度,但在紧凑性和摘要超越OF-Curring AG模式的可能性下降。其他尝试使用了非常通用的映射,因为无法静态检查AG良好的映射。我们在Haskell中展示了AG的类型嵌入,满足所有这些要求。关键在于使用HLIST样类型的异质授权集合(可扩展多晶型记录),并将AG良好的条件表达为类型级谓词(即类型类约束)。通过进一步的类型级别编程,我们还可以表达常见的编程模式,对应于MONAD的典型用例,例如读者,编写器和状态。本文介绍了哈尔克尔的基于类类型的类型级编程的实际示例。

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号