Skip to main content
Article thumbnail
Location of Repository

Polymonads

By Nikhil Swamy, Gavin Bierman, Nataliya Guts, Michael Hicks and Daan Leijen

Abstract

From their semantic origins to their use in structuring effectful computations, monads are now also used as a programming pattern to structure code in a number of important scenarios, including for program verification, for information flow tracking, to compute complexity bounds, and for defining precise type-and-effect analyses. However, whilst these examples are inspired by monads they are not strictly speaking monadic but rather something more general. The first contribution of this paper is the definition of a new categorical structure, the polymonad, which explains these notquite-monadic constructions, and subsumes well-known concepts including monads, layered monads, and systems of monads and monad morphisms, among others. We show how to interpret polymonads in the setting of System Fω. While this interpretaion enables several useful programming idioms, programming directly with polymonads in Fω is far from convenient. Addressing this concern, the second contribution of this paper is core ML-like programming language, λPM, with a polymorphic type inference algorithm that infers a principal polymonadic type for a program and elaborates it to Fω in a coherent way—all unambiguous typing derivations produce elaborated programs with the same semantics. The resulting programming style in λPM is powerful and lightweight, as we demonstrate through a series of examples. 1

Year: 2013
OAI identifier: oai:CiteSeerX.psu:10.1.1.353.4461
Provided by: CiteSeerX
Download PDF:
Sorry, we are unable to provide the full text but you may find it at the following location(s):
  • http://citeseerx.ist.psu.edu/v... (external link)
  • http://research.microsoft.com/... (external link)
  • Suggested articles


    To submit an update or takedown request for this paper, please submit an Update/Correction/Removal Request.