skip to main content
10.1145/1863495.1863501acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Generic selections of subexpressions

Published:26 September 2010Publication History

ABSTRACT

Tools for computer languages need position information: compilers for providing better error messages, structure editors for mapping between structural and textual views, and debuggers for navigating through a term, for instance. Manually adding position information to an abstract syntax tree is tedious and requires pervasive changes: the original tree becomes verbose and every function operating on it needs to be adapted.

In this paper, we describe how to automatically extend datatypes with position information using datatype-generic programming techniques. Furthermore, we show examples of how to use this position information: parsers that automatically construct trees annotated with positions, catamorphisms that deal with failure by reporting error locations, and zippers that efficiently navigate annotated trees. The generic programming technique we describe is applicable to a wide range of domains.

Skip Supplemental Material Section

Supplemental Material

wgp-1150-jeuring.mov

mov

175.8 MB

References

  1. }}Gerard Huet. Functional pearl: The zipper. Journal of Functional Programming, 7(5):549--554, September 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. }}Oleg Kiselyov and Chung-chieh Shan. Annotating trees post factum. http://okmij.org/ftp/Algorithms.html#tree-annot, July 2008. {Code file TEvalNR.hs; Online; accessed 21-July-2010}.Google ScholarGoogle Scholar
  3. }}Jeroen Leeuwestein and Martijn van Steenbergen. GroteTrap. http:// www.haskell.org/haskellwiki/GroteTrap, June 2008. {Online; accessed 21-July-2010}.Google ScholarGoogle Scholar
  4. }}Daan Leijen and Erik Meijer. Parsec: Direct style monadic parser combinators for the real world. Technical Report UU-CS-2001-35, Department of Information and Computing Sciences, Utrecht University, 2001.Google ScholarGoogle Scholar
  5. }}Grant Malcolm. Data structures and program transformation. Science of Computer Programming, 14(2-3):255--279, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. }}Conor McBride. The derivative of a regular type is its type of one-hole contexts (extended abstract), 2001. Unpublished manuscript, available via http://strictlypositive.org/diff.pdf.Google ScholarGoogle Scholar
  7. }}Conor McBride and Ross Paterson. Applicative programming with effects. Journal of Functional Programming, 18(1):1--13, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. }}Thomas van Noort, Alexey Rodriguez Yakushev, Stefan Holdermans, Johan Jeuring, and Bastiaan Heeren. A lightweight approach to datatypegeneric rewriting. In Workshop on Generic Programming 2008, pages 13--24. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. }}Simon Peyton Jones et al. Haskell 98, Language and Libraries. The Revised Report. Cambridge University Press, 2003. A special issue of Journal of Functional Programming.Google ScholarGoogle Scholar
  10. }}Alexey Rodriguez Yakushev, Stefan Holdermans, Andres Löh, and Johan Jeuring. Generic programming with fixed points for mutually recursive datatypes. In International Conference on Functional Programming 2009, pages 233--244. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. }}Martijn M. Schrage. Proxima - a presentation-oriented editor for structured documents. PhD thesis, Utrecht University, The Netherlands, October 2004.Google ScholarGoogle Scholar
  12. }}Tom Schrijvers, Simon Peyton Jones, Manuel M. T. Chakravarty, and Martin Sulzmann. Type checking with open type functions. In International Conference on Functional Programming 2008, pages 51--62. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. }}Martijn van Steenbergen. Generic selections of subexpressions. Master's thesis, Utrecht University, 2010.Google ScholarGoogle Scholar
  14. }}Wouter Swierstra. Data types à la carte. Journal of Functional Programming, 18(4):423--436, July 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. }}Sebastiaan Visser and Andres Löh. Generic storage in Haskell. In Workshop on Generic Programming 2010. ACM, 2010. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Generic selections of subexpressions

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      WGP '10: Proceedings of the 6th ACM SIGPLAN workshop on Generic programming
      September 2010
      116 pages
      ISBN:9781450302517
      DOI:10.1145/1863495

      Copyright © 2010 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 26 September 2010

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate30of43submissions,70%

      Upcoming Conference

      ICFP '24

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader