Skip to main content

Monad Factory: Type-Indexed Monads

  • Conference paper
Trends in Functional Programming (TFP 2010)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 6546))

Included in the following conference series:

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 work-around. 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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Gill, A.: mtl: The Monad Transformer Library (September 2010), http://hackage.haskell.org/package/mtl-1.1.1.0

  2. GHC: The Glasgow Haskell Compiler, http://haskell.org/ghc/

  3. Snyder, M.: mtlx: Monad transformer library with type indexes, providing ’free’ copies (October 2010), http://hackage.haskell.org/package/mtlx-0.1.5

  4. Harrison, W.L., Hook, J.: Achieving information flow security through precise control of effects. In: CSFW 2005: Proceedings of the 18th IEEE Workshop on Computer Security Foundations, pp. 16–30. IEEE Computer Society, Washington, DC (2005)

    Google Scholar 

  5. McBride, C.: Faking It - Simulating Dependent Types in Haskell. J. Funct. Program 12(5), 375–392 (2002)

    MathSciNet  MATH  Google Scholar 

  6. Cheney, J., Hinze, R.: First-class phantom types. Technical report, Cornell University (2003)

    Google Scholar 

  7. Claessen, K., Hughes, J.: QuickCheck: a lightweight tool for random testing of Haskell programs. In: ICFP 2000: Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, pp. 268–279. ACM, New York (2000)

    Chapter  Google Scholar 

  8. Moggi, E.: An Abstract View of Programming Languages. Technical Report ECS-LFCS-90-113, Dept. of Comp. Sci., Edinburgh Univ. (1990)

    Google Scholar 

  9. Wadler, P.L.: Comprehending Monads. In: Proceedings of the 1990 ACM Conference on LISP and Functional Programming, pp. 61–78. ACM, New York (1990)

    Chapter  Google Scholar 

  10. Wadler, P.: The Essence of Functional Programming. In: Conference Record of the Nineteenth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Albequerque, New Mexico, pp. 1–14 (1992)

    Google Scholar 

  11. Jones, M.P.: Functional Programming with Overloading and Higher-Order Polymorphism. In: Jeuring, J., Meijer, E. (eds.) AFP 1995. LNCS, vol. 925, pp. 97–136. Springer, Heidelberg (1995)

    Chapter  Google Scholar 

  12. Kariotis, P.S., Procter, A.M., Harrison, W.L.: Making Monads First-Class with Template Haskell. In: Haskell 2008: Proceedings of the First ACM SIGPLAN Symposium on Haskell, pp. 99–110. ACM, New York (2008)

    Chapter  Google Scholar 

  13. Sheard, T., Jones, S.P.: Template Meta-Programming for Haskell. SIGPLAN Not 37(12), 60–75 (2002)

    Article  Google Scholar 

  14. Atkey, R.: Parameterized Notions of Computation. In: Proceedings of Workshop on Mathematically Structured Functional Programming (July 2006)

    Google Scholar 

  15. Jaskelioff, M.: Monatron: An Extensible Monad Transformer Library. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 64–79. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  16. Kiselyov, O., Lämmel, R., Schupke, K.: Strongly Typed Heterogeneous Collections. In: Haskell 2004: Proceedings of the ACM SIGPLAN Workshop on Haskell, pp. 96–107. ACM Press, New York (2004)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2011 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Snyder, M., Alexander, P. (2011). Monad Factory: Type-Indexed Monads. In: Page, R., Horváth, Z., Zsók, V. (eds) Trends in Functional Programming. TFP 2010. Lecture Notes in Computer Science, vol 6546. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-22941-1_13

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-22941-1_13

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-22940-4

  • Online ISBN: 978-3-642-22941-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics