skip to main content
research-article

Deconstraining DSLs

Published:09 September 2012Publication History
Skip Abstract Section

Abstract

Strongly-typed functional languages provide a powerful framework for embedding Domain-Specific Languages (DSLs). However, building type-safe functions defined over an embedded DSL can introduce application-specific type constraints that end up being imposed on the DSL data types themselves. At best, these constraints are unwieldy and at worst they can limit the range of DSL expressions that can be built. We present a simple solution to this problem that allows application-specific constraints to be specified at the point of use of a DSL expression rather than when the DSL's embedding types are defined. Our solution applies equally to both tagged and tagless representations and, importantly, also works in the presence of higher-rank types.

References

  1. L. Augustsson, H. Mansell, and G. Sittampalam. Paradise: A Two-Stage DSL Embedded in Haskell. In phProceedings of the 13th ACM SIGPLAN International Conference on Functional Programming, ICFP '08, pages 225--228, New York, NY, USA, 2008. ACM. ISBN 978--1--59593--919--7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. E. Axelsson, K. Claessen, M. Sheeran, J. Svenningsson, D. Engdal, and A. Persson. The Design and Implementation of Feldspar - An Embedded Language for Digital Signal Processing. In phProceedings of the 22nd Symposium on Implementation and Application of Functional Languages, Lecture Notes in Computer Science, pages 121--136. Springer-Verlag, 2010. ISBN 978--3--642--24275--5. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. E. C. Brady. IDRIS -- Systems Programming Meets Full Dependent Types. In phProceedings of the 5th ACM Workshop on Programming Languages Meets Program Verification, PLPV '11, pages 43--54, New York, NY, USA, 2011. ACM. ISBN 978--1--4503-0487-0. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. E. C. Brady and K. Hammond. Scrapping your Inefficient Engine: Using Partial Evaluation to Improve Domain-Specific Language Implementation. phACM SIGPLAN Notices, 45 (9): 297--308, September 2010. ISSN 0362--1340. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. J. Carette, O. Kiselyov, and C. chieh Shan. Finally Tagless, Partially Evaluated: Tagless Staged Interpreters for Simpler Typed Languages. phJournal of Functional Programming, 19: 509--543, September 2009. ISSN 0956--7968. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. and Marlow}Chakravarty05AssociatedM. M. T. Chakravarty, G. Keller, S. Peyton Jones, and S. Marlow. Associated Types with Class. In phProceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL '05, pages 1--13, New York, NY, USA, 2005. ACM. ISBN 1--58113--830-X. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. M. M. T. Chakravarty, G. Keller, S. Lee, T. L. McDonell, and V. Grover. Accelerating Haskell Array Codes with Multicore GPUs. In phProceedings of the 6th Workshop on Declarative Aspects of Multicore Programming, DAMP '11, pages 3--14, New York, NY, USA, 2011. ACM. ISBN 978--1--4503-0486--3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. C. Elliott, S. Finne, and O. de Moor. Compiling Embedded Languages. phJournal of Functional Programming, 13 (3): 455--481, 2003. ISSN 0956--7968. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. K. Hammond, J. Berthold, and R. Loogen. Automatic Skeletons in Template Haskell. phParallel Processing Letters, 13 (3): 413--424, September 2003. ISSN 0129--6264.Google ScholarGoogle ScholarCross RefCross Ref
  10. C. Hofer, K. Ostermann, T. Rendel, and A. Moors. Polymorphic Embedding of DSLs. In phProceedings of the 7th International Conference on Generative Programming and Component Engineering, GPCE '08, pages 137--148, New York, NY, USA, 2008. ACM. ISBN 978--1--60558--267--2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. J. Hughes. Restricted Data Types in Haskell. In phProceedings of the 1999 Haskell Workshop. University of Utrecht, Technical Report UU-CS-1999--28, October 1999.Google ScholarGoogle Scholar
  12. O. Kiselyov and C. chieh Shan. Functional Pearl: Implicit Configurations--or, Type Classes Reflect the Values of Types. In phProceedings of the 2004 ACM SIGPLAN Workshop on Haskell, Haskell '04, pages 33--44, New York, NY, USA, 2004. ACM. ISBN 1--58113--850--4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. el, and Schupke}Kiselyov04HListO. Kiselyov, R. L\"ammel, and K. Schupke. Strongly Typed Heterogeneous Collections. In phProceedings of the 2004 ACM SIGPLAN Workshop on Haskell, Haskell '04, pages 96--107, New York, NY, USA, 2004. ACM. ISBN 1--58113--850--4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. D. Leijen and E. Meijer. Domain-Specific Embedded Compilers. In phProceedings of the 2nd Conference on Domain-Specific Languages - Volume 2, DSL'99, pages 109--122, Berkeley, CA, USA, 1999. USENIX Association. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. G. Mainland and G. Morrisett. Nikola: Embedding Compiled GPU Functions in Haskell. In phProceedings of the 3rd ACM Haskell Symposium, Haskell '10, pages 67--78, New York, NY, USA, 2010. ACM. ISBN 978--1--4503-0252--4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. C. McBride. Faking It: Simulating Dependent Types in Haskell. phJournal of Functional Programming, 12: 375--392, July 2002. ISSN 0956--7968. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. U. Norell. phTowards a Practical Programming Language based on Dependent Type Theory. PhD thesis, Department of Computer Science and Engineering, Chalmers University of Technology, SE-412 96 Göteborg, Sweden, September 2007.Google ScholarGoogle Scholar
  18. M. Odersky, P. Altherr, V. Cremet, B. Emir, S. Maneth, S. Micheloud, N. Mihaylov, M. Schinz, E. Stenman, and M. Zenger. An Overview of the Scala Programming Language. Technical Report IC/2004/64, EPFL Lausanne, Switzerland, 2004.Google ScholarGoogle Scholar
  19. D. A. Orchard and T. Schrijvers. Haskell Type Constraints Unleashed. In phProceedings of the 10th International Symposium on Functional and Logic Programming, Lecture Notes in Computer Science, pages 56--71. Springer-Verlag, 2010. ISBN 978--3--642--12251--4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. N. Oury and W. Swierstra. The Power of Pi. In phProceedings of the 13th ACM SIGPLAN International Conference on Functional Programming, ICFP '08, pages 39--50, New York, NY, USA, 2008. ACM. ISBN 978--1--59593--919--7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. E. Pavsalić, W. Taha, and T. Sheard. Tagless Staged Interpreters for Typed Languages. In phProceedings of the 7th ACM SIGPLAN International Conference on Functional Programming, ICFP '02, pages 218--229, New York, NY, USA, 2002. ACM. ISBN 1--58113--487--8. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. t al.(1997)Peyton Jones, Jones, and Meijer}Jones97TypeClassDesignS. Peyton Jones, M. Jones, and E. Meijer. Type Classes: Exploring the Design Space. In phProceedings of the 1997 Haskell Workshop, 1997.Google ScholarGoogle Scholar
  23. t al.(2007)Peyton Jones, Vytiniotis, Weirich, and Shields}Jones07PracticalS. Peyton Jones, D. Vytiniotis, S. Weirich, and M. Shields. Practical Type Inference for Arbitrary-Rank Types. phJournal of Functional Programming, 17: 1--82, January 2007. ISSN 0956--7968. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Sulzmann, and Vytiniotis}Schrijvers09CompleteGADTsT. Schrijvers, S. Peyton Jones, M. Sulzmann, and D. Vytiniotis. Complete and Decidable Type Inference for GADTs. In phProceedings of the 14th ACM SIGPLAN International Conference on Functional Programming, ICFP '09, pages 341--352, New York, NY, USA, 2009. ACM. ISBN 978--1--60558--332--7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. S. Seefried, M. M. T. Chakravarty, and G. Keller. Optimising Embedded DSLs Using Template Haskell. In phGPCE '04, volume 3286 of phLecture Notes in Computer Science, pages 186--205. Springer-Verlag, 2004. ISBN 3--540--23580--9.Google ScholarGoogle Scholar
  26. 002)}Sheard02TemplateT. Sheard and S. Peyton Jones. Template Meta-Programming for Haskell. phSIGPLAN Notices, 37: 60--75, December 2002. ISSN 0362--1340. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Vytiniotis06BoxyD. Vytiniotis, S. Weirich, and S. Peyton Jones. Boxy Types: Inference for Higher-Rank Types and Impredicativity. In phProceedings of the 11th ACM SIGPLAN International Conference on Functional Programming, ICFP '06, pages 251--262, New York, NY, USA, 2006. ACM. ISBN 1--59593--309--3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. P. Wadler and S. Blott. How to Make Ad-Hoc Polymorphism Less Ad Hoc. In phProceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL '89, pages 60--76, New York, NY, USA, 1989. ACM. ISBN 0--89791--294--2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Vytiniotis, and aes}Yorgey12PromotionB. A. Yorgey, S. Weirich, J. Cretin, S. Peyton Jones, D. Vytiniotis, and J. P. M. aes. Giving Haskell a Promotion. In phProceedings of the 8th ACM SIGPLAN Workshop on Types in Language Design and Implementation, TLDI '12, pages 53--66, New York, NY, USA, 2012. ACM. ISBN 978--1--4503--1120--5. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Deconstraining DSLs

          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

          Full Access

          • Published in

            cover image ACM SIGPLAN Notices
            ACM SIGPLAN Notices  Volume 47, Issue 9
            ICFP '12
            September 2012
            368 pages
            ISSN:0362-1340
            EISSN:1558-1160
            DOI:10.1145/2398856
            Issue’s Table of Contents
            • cover image ACM Conferences
              ICFP '12: Proceedings of the 17th ACM SIGPLAN international conference on Functional programming
              September 2012
              392 pages
              ISBN:9781450310543
              DOI:10.1145/2364527

            Copyright © 2012 ACM

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 9 September 2012

            Check for updates

            Qualifiers

            • research-article

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader
          About Cookies On This Site

          We use cookies to ensure that we give you the best experience on our website.

          Learn more

          Got it!