Advertisement

Monad Factory: Type-Indexed Monads

  • Mark Snyder
  • Perry Alexander
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6546)

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.

Keywords

monads Haskell type-level programming 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Gill, A.: mtl: The Monad Transformer Library (September 2010), http://hackage.haskell.org/package/mtl-1.1.1.0
  2. 2.
    GHC: The Glasgow Haskell Compiler, http://haskell.org/ghc/
  3. 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. 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. 5.
    McBride, C.: Faking It - Simulating Dependent Types in Haskell. J. Funct. Program 12(5), 375–392 (2002)MathSciNetzbMATHGoogle Scholar
  6. 6.
    Cheney, J., Hinze, R.: First-class phantom types. Technical report, Cornell University (2003)Google Scholar
  7. 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)CrossRefGoogle Scholar
  8. 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. 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)CrossRefGoogle Scholar
  10. 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. 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)CrossRefGoogle Scholar
  12. 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)CrossRefGoogle Scholar
  13. 13.
    Sheard, T., Jones, S.P.: Template Meta-Programming for Haskell. SIGPLAN Not 37(12), 60–75 (2002)CrossRefGoogle Scholar
  14. 14.
    Atkey, R.: Parameterized Notions of Computation. In: Proceedings of Workshop on Mathematically Structured Functional Programming (July 2006)Google Scholar
  15. 15.
    Jaskelioff, M.: Monatron: An Extensible Monad Transformer Library. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 64–79. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  16. 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

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Mark Snyder
    • 1
  • Perry Alexander
    • 1
  1. 1.Information and Telecommunication Technology CenterThe University of KansasLawrenceUSA

Personalised recommendations