Monad factory: type-indexed monads

  • Authors:
  • Mark Snyder;Perry Alexander

  • Affiliations:
  • The University of Kansas, Information and Telecommunication Technology Center, Lawrence, KS;The University of Kansas, Information and Telecommunication Technology Center, Lawrence, KS

  • Venue:
  • TFP'10 Proceedings of the 11th international conference on Trends in functional programming
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

Monads provide a greatly useful capability to pure languages in simulating side-effects, but implementations such as the Monad Transformer Library [1] in Haskell prohibit reuse of those side-effects such as threading through two different states without some explicit workaround. Monad Factory provides a straightforward solution for opening the non-proper morphisms by indexing monads at both the type-level and term-level, allowing 'copies' of the monads to be created and simultaneously used within even the same monadic transformer stack. This expands monads' applicability and mitigates the amount of boilerplate code we need for monads to work together, and yet we use them nearly identically to non-indexed monads.