Programming and reasoning with algebraic effects and dependent types

Research output: Chapter in Book/Report/Conference proceedingConference contribution

Abstract

One often cited benefit of pure functional programming is that pure code is
easier to test and reason about, both formally and informally. However,
real programs have side-effects including state management, exceptions and
interactions with the outside world.
Haskell solves this problem using monads to capture
details of possibly side-effecting computations --- it provides monads for
capturing state, I/O, exceptions, non-determinism, libraries for practical
purposes such as CGI and parsing, and many others, as well as monad
transformers for combining multiple effects.

Unfortunately, useful as monads are, they do not compose very well. Monad
transformers can quickly become unwieldy when there are lots of effects to
manage, leading to a temptation in larger programs to combine everything into
one coarse-grained state and exception monad. In this paper I describe an
alternative approach based on handling algebraic effects, implemented
in the Idris programming language. I show how to describe side effecting
computations, how to write programs which compose multiple fine-grained
effects, and how, using dependent types, we can use this approach to reason
about states in effectful programs.
Original languageEnglish
Title of host publicationICFP '13
Subtitle of host publicationProceedings of the 18th ACM SIGPLAN international conference on Functional programming
Place of PublicationNew York
PublisherACM
Pages133-144
ISBN (Print)978-1-4503-2326-0
DOIs
Publication statusPublished - 2013

Keywords

  • Dependent Types
  • Algebraic Effects

Fingerprint

Dive into the research topics of 'Programming and reasoning with algebraic effects and dependent types'. Together they form a unique fingerprint.

Cite this