Refinement types enrich a language's type system with logical predicates that circumscribe the set of values described by the type, thereby providing software developers a tunable knob with which to inform the type system about what invariants and correctness properties should be checked on their code. In this article, we distill the ideas developed in the substantial literature on refinement types into a unified tutorial that explains the key ingredients of modern refinement type systems. In particular, we show how to implement a refinement type checker via a progression of languages that incrementally add features to the language or type system.
翻译:精细类型使语言类型系统丰富,具有逻辑前提,限定按类型描述的一组值,从而为软件开发者提供一个调试键,用以向类型系统通报其代码中应检查哪些变异性和正确性。在本条中,我们将大量文献中关于精细类型的想法提炼成一个解释现代精细类型系统关键成分的统一教程。特别是,我们展示了如何通过逐步增加语言,为语言或类型系统增加特征的精细类型检查器。