Skip to main content Accessibility help
×
Home

The Kansas University rewrite engine: A Haskell-Embedded Strategic Programming Language with Custom Closed Universes

  • NEIL SCULTHORPE (a1), NICOLAS FRISBY (a1) and ANDY GILL (a1)

Abstract

When writing transformation systems, a significant amount of engineering effort goes into setting up the infrastructure needed to direct individual transformations to specific targets in the data being transformed. Strategic programming languages provide general-purpose infrastructure for this task, which the author of a transformation system can use for any algebraic data structure. The Kansas University Rewrite Engine (KURE) is a typed strategic programming language, implemented as a Haskell-embedded domain-specific language. KURE is designed to support typed transformations over typed data, and the main challenge is how to make such transformations compatible with generic traversal strategies that should operate over any type. Strategic programming in a typed setting has much in common with datatype-generic programming. Compared to other approaches to datatype-generic programming, the distinguishing feature of KURE's solution is that the user can configure the behaviour of traversals based on the location of each datum in the tree, beyond their behaviour being determined by the type of each datum. This article describes KURE's approach to assigning types to generic traversals, and the implementation of that approach. We also compare KURE, its design choices, and their consequences, with other approaches to strategic and datatype-generic programming.

Copyright

References

Hide All
Adams, M. D., Farmer, A. & Magalhães, J. P. (2014) Optimizing SYB is easy! In Workshop on Partial Evaluation and Program Manipulation. New York, NY: ACM, pp. 7182.
Balland, E., Moreau, P.-E. & Reilles, A. (2008) Rewriting strategies in Java. In Eighth International Workshop on Rule Based Programming, Electronic Notes in Theoretical Computer Science, vol. 219. Amsterdam: Elsevier, pp. 97111.
Bravenboer, M., Kalleberg, K. T., Vermaas, R. & Visser, E. (2008) Stratego/XT 0.17. A language and toolset for program transformation. Sci. Comput. Program. 72 (1–2), 5270.
Bringert, B. & Ranta, A. (2008) A pattern for almost compositional functions. J. Funct. Program. 18 (5–6), 567598.
Brown, N. C. C. & Sampson, A. T. (2009) Alloy: Fast generic transformations for Haskell. In Haskell Symposium. New York, NY: ACM, pp. 105116.
Burstall, R. M. & Darlington, J. (1977) A transformation system for developing recursive programs. J. ACM 24 (1), 4467.
Culpepper, R. (2012) Fortifying macros. J. Funct. Program. 22 (4–5), 439476.
Culpepper, R. & Felleisen, M. (2010) Fortifying macros. In International Conference on Functional Programming. New York, NY: ACM, pp. 235246.
Dolstra, E. (2001) First Class Rules and Generic Traversals for Program Transformation Languages, Master's thesis, Utrecht University.
Dolstra, E. & Visser, E. (2001) First-Class Rules and Generic Traversal. Tech. rept. UU-CS-2001-38. Utrecht University, Utrecht.
Ellison, C. & Roşu, G. (2012) An executable formal semantics of C with applications. In Symposium on Principles of Programming Languages. New York, NY: ACM, pp. 533544.
Erdweg, S., Rendel, T., Kästner, C. & Ostermann, K. (2011) SugarJ: Library-based syntactic language extensibility. In International Conference on Object-Oriented Programming, Systems, Languages, and Applications. New York, NY: ACM, pp. 391406.
Erdweg, S. & Rieger, F. (2013) A framework for extensible languages. In International Conference on Generative Programming: Concepts & Experiences. New York, NY: ACM, pp. 312.
Erdweg, S., Rieger, F., Rendel, T. & Ostermann, K. (2012) Layout-sensitive language extensibility with SugarHaskell. In Haskell Symposium. New York, NY: ACM, pp. 149160.
Erdweg, S., Vergu, V., Mezini, M. & Visser, E. (2014) Modular specification and dynamic enforcement of syntactic language constraints when generating code. In International Conference on Modularity. New York, NY: ACM, pp. 241252.
Farmer, A., Gill, A., Komp, E. & Sculthorpe, N. (2012) The HERMIT in the machine: A plugin for the interactive transformation of GHC core language programs. In Haskell Symposium. New York, NY: ACM, pp. 112.
Felleisen, M., Findler, R. B. & Flatt, M. (2009) Semantics Engineering with PLT Redex. Cambridge, MA: MIT Press.
Frisby, N., Gill, A. & Alexander, P. (2012) A pattern for almost homomorphic functions. In Workshop on Generic Programming. New York, NY: ACM, pp. 112.
Gibbons, J. (2005) Patterns in datatype-generic programming. In Workshop on Declarative Programming in the Context of Object-Oriented Languages 2003, Striegnitz, J. & Davis, K. (eds), NIC Series, vol. 27. Jülich: NIC, pp. 277289.
Gill, A. (2006) Introducing the Haskell equational reasoning assistant. In Haskell Workshop. New York, NY: ACM, pp. 108109.
Gill, A. (2009) A Haskell hosted DSL for writing transformation systems. In Working Conference on Domain-Specific Languages, Taha, W. (ed), Lecture Notes in Computer Science, vol. 5658. Berlin: Springer, pp. 285309.
Girard, J.-Y.. (1972) Interprétation fonctionelle et élimination des coupures de l'arithmétique d'ordre supérieur. Ph.D. thesis, Université Paris Diderot, Paris.
Hinze, R. & Löh, A. (2007) Generic programming, now! International spring school on datatype-generic programming 2006, Backhouse, R., Gibbons, J., Hinze, R. & Jeuring, J. (eds), Lecture Notes in Computer Science, vol. 4719. Berlin: Springer, pp. 150208.
Hinze, R. & Löh, A. (2009) Generic programming in 3D. Sci. Comput. Program. 74 (8), 590628.
Hughes, R. J. M. (1986) A novel representation of lists and its application to the function “reverse”. Inf. Process. Lett. 22 (3), 141144.
Kats, L. C. L. & Visser, E. (2010) The Spoofax language workbench. Rules for declarative specification of languages and IDEs. In International Conference on Object-Oriented Programming, Systems, Languages, and Applications. New York, NY: ACM, pp. 444463.
Kiselyov, O. (2006) Smash your boiler-plate without class and typeable. http://article.gmane.org/gmane.comp.lang.haskell.general/14086.
Klein, C., Clements, J., Dimoulas, C., Eastlund, C., Felleisen, M., Flatt, M., McCarthy, J. A., Rafkind, J., Tobin-Hochstadt, S. & Findler, R. B. (2012) Run your research: On the effectiveness of lightweight mechanization. In Symposium on Principles of Programming Languages. New York, NY: ACM, pp. 285296.
Lämmel, R. & Peyton, Jones, S. (2003) Scrap your boilerplate: A practical design pattern for generic programming. In Types in Languages Design and Implementation. New York, NY: ACM, pp. 2637.
Lämmel, R. & Visser, J. (2002) Typed combinators for generic traversal. International Symposium on Practical Aspects of Declarative Programming, Krishnamurthi, S. & Ramakrishnan, C. R. (eds), Lecture Notes in Computer Science, vol. 2257. Berlin: Springer, pp. 137154.
Lazar, D., Arusoaie, A., Serbanuta, T. F., Ellison, C., Mereuta, R., Lucanu, D. & Roşu, G. (2012) Executing formal semantics with the K tool. In International symposium on formal methods, Giannakopoulou, D. & Méry, D. (eds), Lecture Notes in Computer Science, vol. 7436. Berlin: Springer, pp. 267271.
Liang, S., Hudak, P. & Jones, M. (1995) Monad transformers and modular interpreters. In Symposium on Principles of Programming Languages. New York, NY: ACM, pp. 333343.
Löh, A. & Magalhães, J. P. (2011) Generic programming with indexed functors. In Workshop on Generic Programming. New York, NY: ACM, pp. 112.
Magalhães, J. P., Dijkstra, A., Jeuring, J. & Löh, A. (2010) A generic deriving mechanism for Haskell. In Haskell Symposium. New York, NY: ACM, pp. 3748.
McBride, C. & Paterson, R. (2008) Applicative programming with effects. J. Funct. Program. 18 (1), 113.
Mitchell, N. & Runciman, C. (2007) Uniform boilerplate and list processing. In Haskell Workshop. New York, NY: ACM, pp. 4960.
Moors, A., Piessens, F. & Joosen, W. (2006) An object-oriented approach to datatype-generic programming. In Workshop on Generic Programming. New York, NY: ACM, pp. 96106.
van Noort, T., Rodriguez Yakushev, A., Holdermans, S., Jeuring, J., Heeren, B. & Magalhães, J. P. (2010) A lightweight approach to datatype-generic rewriting. J. Funct. Program. 20 (3–4), 375413.
O'Connor, R. (2011) Functor is to Lens as Applicative is to Biplate: Introducing Multiplate. Workshop on generic programming. Available at http://arxiv.org/abs/1103.2841.
Oliveira, B. C. D. S. & Gibbons, J. (2010) Scala for generic programmers. J. Funct. Program. 20 (3–4), 303352.
Peyton Jones, S. (2007) Call-pattern specialisation for Haskell programs. In International Conference on Functional Programming. New York, NY: ACM, pp. 327337.
Peyton Jones, S., Vytiniotis, D., Weirich, S. & Shields, M. (2007) Practical type inference for arbitrary-rank types. J. Funct. Program. 17 (1), 182.
Reynolds, J. C. (1974) Towards a theory of type structure. In Colloque sur la programmation, Robinet, B. (ed), Lecture Notes in Computer Science, vol. 19. Berlin: Springer, pp. 408423.
Rodriguez Yakushev, A., Jeuring, J., Jansson, P., Gerdes, A., Kiselyov, O. & Oliveira, B. (2008) Comparing libraries for generic programming in Haskell. In Haskell Symposium. New York, NY: ACM, pp. 111122.
Santos, A. (1995) Compilation by Transformation in Non-Strict Functional Languages. Ph.D. thesis, University of Glasgow, Glasgow.
Schmidt, U., Schmidt, M. & Kuseler, T. (2012) http://hackage.haskell.org/package/hxt.
Sculthorpe, N., Farmer, A. & Gill, A. (2013) The HERMIT in the tree: Mechanizing program transformations in the GHC core language. In International Symposium on Implementation and Application of Functional Languages 2012, Hinze, R. (ed), Lecture Notes in Computer Science, vol. 8241. Berlin: Springer, pp. 86103.
Sculthorpe, N. & Gill, A. (2014) http://hackage.haskell.org/package/kure.
Sheard, T. & Peyton Jones, S. (2002) Template metaprogramming for Haskell. In Haskell Workshop. New York, NY: ACM, pp. 116.
Strachey, C. (1967) Fundamental Concepts in Programming Languages. Lecture Notes, International Summer School in Computer Programming, Copenhagen. Reprinted in Higher-Order and Symbolic Computation, 13 (1–2), 1149, 2000.
Sulzmann, M., Chakravarty, M. M. T., Peyton Jones, S. & Donnelly, K. (2007) System F with type equality coercions. In International Workshop on Types in Language Design and Implementation. New York, NY: ACM, pp. 5366.
Swierstra, W. (2008) Data types à la carte. J. Funct. Program, 18 (4), 423436.
Tseitin, G. S. (1968). On the complexity of derivations in the propositional calculus. In Structures in Constructive Mathematics and Mathematical Logic, Part II, Slisenko, A.O. (ed), Seminars in Mathematics, vol. 8. Moscow: Steklov Mathematical Institute, pp. 115125. Reprinted in Pages 466–483 of: Automation of reasoning, Springer, 1983.
Visser, E. (2004) Program transformation with Stratego/XT: Rules, strategies, tools, and systems in StrategoXT-0.9. In International Seminar on Domain-Specific Program Generation 2003, Lengauer, C., Batory, D., Consel, C. & Odersky, M. (eds), Lecture Notes in Computer Science, vol. 3016. Berlin: Springer, pp. 216238.
Visser, E. (2005) A survey of strategies in rule-based program transformation systems. J. Symb. Comput. 40 (1), 831873.
Visser, E. (2013). Personal communication.
Visser, E., Benaissa, Zine-el-Abidine, & Tolmach, A. (1998) Building program optimizers with rewriting strategies. In International Conference on Functional Programming. New York, NY: ACM, pp. 1326.
Wadler, P. (1992) The essence of functional programming. Symposium on Principles of Programming Languages. New York, NY: ACM, pp. 114.
Wadler, P. & Blott, S. (1989) How to make ad-hoc polymorphism less ad hoc. In Symposium on Principles of Programming Languages. New York, NY: ACM, pp. 6076.

Related content

Powered by UNSILO
Type Description Title
UNKNOWN
Supplementary materials

Sculthorpe Supplementary Material
Supplementary Material

 Unknown (31 KB)
31 KB

The Kansas University rewrite engine: A Haskell-Embedded Strategic Programming Language with Custom Closed Universes

  • NEIL SCULTHORPE (a1), NICOLAS FRISBY (a1) and ANDY GILL (a1)

Metrics

Altmetric attention score

Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed.

The Kansas University rewrite engine: A Haskell-Embedded Strategic Programming Language with Custom Closed Universes

  • NEIL SCULTHORPE (a1), NICOLAS FRISBY (a1) and ANDY GILL (a1)
Submit a response

Discussions

No Discussions have been published for this article.

×

Reply to: Submit a response


Your details


Conflicting interests

Do you have any conflicting interests? *