Skip to main content

Resource-Dependent Algebraic Effects

  • Conference paper
  • First Online:
Book cover Trends in Functional Programming (TFP 2014)

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

Included in the following conference series:

Abstract

There has been significant interest in recent months in finding new ways to implement composable and modular effectful programs using handlers of algebraic effects. In my own previous work, I have shown how an algebraic effect system (called effects) can be embedded directly in a dependently typed host language. Using dependent types ought to allow precise reasoning about programs; however, the reasoning capabilities of effects have been limited to simple state transitions which are known at compile-time. In this paper, I show how effects can be extended to support reasoning in the presence of run-time state transitions, where the result may depend on run-time information about resource usage (e.g. whether opening a file succeeded). I show how this can be used to build expressive APIs, and to specify and verify the behaviour of interactive, stateful programs. I illustrate the technique using a file handling API, and an interactive game.

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 34.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 44.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. Aldrich, J., Sunshine, J., Saini, D., Sparks, Z.: Typestate-oriented programming. In: Proceedings of the 24th Conference on Object Oriented Programming Systems Languages and Applications, pp. 1015–1012 (2009)

    Google Scholar 

  2. Bauer, A., Pretnar, M.: Programming with Algebraic Effects and Handlers (2012). http://arxiv.org/abs/1203.1539

  3. Brady, E.: Idris, a general-purpose dependently typed programming language: Design and implementation. Journal of Functional Programming 23, 552–593 (2013)

    Article  MATH  MathSciNet  Google Scholar 

  4. Brady, E.: Programming and reasoning with algebraic effects and dependent types. In: ICFP 2013: Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming. ACM (2013)

    Google Scholar 

  5. Brady, E., Hammond, K.: Correct-by-construction concurrency: Using dependent types to verify implementations of effectful resource usage protocols. Fundamenta Informaticae 102, 145–176 (2010)

    MATH  MathSciNet  Google Scholar 

  6. Fowler, S., Brady, E.: Dependent types for safe and secure web programming. In: Implementation and Application of Functional Languages (IFL) (2013)

    Google Scholar 

  7. Honda, K., Yoshida, N., Carbone, M.: Multiparty asynchronous session types. In: POPL, pp. 273–284 (2008)

    Google Scholar 

  8. Hyland, M., Plotkin, G., Power, J.: Combining effects: Sum and tensor. Theoretical Computer Science 357, 70–99 (2006)

    Article  MATH  MathSciNet  Google Scholar 

  9. Kammar, O., Lindley, S., Oury, N.: Handlers in action. In: Proceedings of the 18th International Conference on Functional Programming (ICFP 2013). ACM (2013)

    Google Scholar 

  10. Kiselyov, O., Sabry, A., Swords, C.: Extensible effects: an alternative to monad transformers. In: Proceedings of the 2013 ACM SIGPLAN Symposium on Haskell, Haskell 2013, pp. 59–70, New York. ACM (2013)

    Google Scholar 

  11. Leijen, D.: Koka: programming with row polymorphic effect types. In: Levy, P., Krishnaswami, N. (eds.) MSFP. EPTCS, vol. 153, pp. 100–126 (2014)

    Google Scholar 

  12. Levy, P.B.: Call-By-Push-Value. PhD thesis, Queen Mary and Westfield College, University of London (2001)

    Google Scholar 

  13. Lippmeier, B.: Witnessing purity, constancy and mutability. In: Hu, Z. (ed.) APLAS 2009. LNCS, vol. 5904, pp. 95–110. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  14. McBride, C.: Kleisli arrows of outrageous fortune (2011), (Draft)

    Google Scholar 

  15. Nanevski, A., Morrisett, G., Shinnar, A., Govereau, P., Birkedal, L.: Ynot: reasoning with the awkward squad. In: ICFP 2008: Proceeding of the 13th ACM SIGPLAN International Conference on Functional Programming, pp. 229–240, New York. ACM (2008)

    Google Scholar 

  16. Plotkin, G., Pretnar, M.: Handlers of algebraic effects. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 80–94. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  17. Pretnar, M.: The Logic and Handling of Algebraic Effects. PhD thesis, University of Edinburgh (2010)

    Google Scholar 

  18. Strom, R., Yemini, S.: Typestate: A programming language concept for enhancing software reliability. IEEE Transactions on Software Engineering SE–12(1), 157–171 (1986)

    Article  Google Scholar 

  19. Walker, D.: A type system for expressive security policies. In: Proceedings of the 27th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2000, pp. 254–267. ACM (2000)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Edwin Brady .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this paper

Cite this paper

Brady, E. (2015). Resource-Dependent Algebraic Effects. In: Hage, J., McCarthy, J. (eds) Trends in Functional Programming. TFP 2014. Lecture Notes in Computer Science(), vol 8843. Springer, Cham. https://doi.org/10.1007/978-3-319-14675-1_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-14675-1_2

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-14674-4

  • Online ISBN: 978-3-319-14675-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics