Abstract

Reasoning about programs that use effects can be much harder than reasoning about their pure counterparts. This paper presents a predicate transformer semantics for a variety of effects, including exceptions, state, non-determinism, and general recursion. The predicate transformer semantics gives rise to a refinement relation that can be used to relate a program to its specification, or even calculate effectful programs that are correct by construction.

Highlights

  • IntroductionPure programs may be tested in isolation; referential transparencyÐthe ability to freely substitute equals for equalsÐenables us to employ equational reasoning to prove two expressions equal [Wadler 1987]

  • One of the key advantages of pure functional programming is compositionality

  • In this paper, we show how to assign predicate transformer semantics to computations arising from the Kleisli arrows on these free monads

Read more

Summary

Introduction

Pure programs may be tested in isolation; referential transparencyÐthe ability to freely substitute equals for equalsÐenables us to employ equational reasoning to prove two expressions equal [Wadler 1987]. The examples of effects studied in this paper will be phrased in terms of such free monads; each effect, described in a separate section, chooses C and R differently, depending on its corresponding operations. This choice of operationsÐas is usually the case for algebraic effectsÐdetermines a syntax to which we must still assign semantics [Hyland et al 2006]

Objectives
Discussion
Conclusion
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call