Fun with Type Functions
Fun with Type Functions
复制标题
类型函数的乐趣
DOI:
10.1007/978-1-84882-912-1_14
复制
发表时间:
2010
影响因子:
6.2
通讯作者:
Chung
中科院分区:
文献类型:
--
作者:
O. Kiselyov;S. Jones;Chung
Tony Hoare has always been a leader in writing down and proving properties of programs. To prove properties of programs automatically, the most widely used technology today is the ubiquitous type checker. Alas, static type systems inevitably exclude some good programs and allow some bad ones. Thus motivated, we describe some fun we have been having with Haskell, by making the type system more expressive without losing the benefits of automatic proof and compact expression. Specifically, we offer a programmer’s tour of so-calledtype families, a recent extension to Haskell that allows functions on types to be expressed as straightforwardly as functions on values. This facility makes it easier for programmers to effectively extend the compiler by writing functional programs that execute during type checking. Source code for all the examples is available at http://research.microsoft.com/simonpj/papers/assoc-types/fun-with-type-funs.zip.