A Shallow Embedded Type Safe Extendable DSL for the Arduino

  • Pieter KoopmanEmail author
  • Rinus Plasmeijer
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9547)


This paper extends our method to construct a shallow embedded domain specific language, DSL, embedded in a function programming language. We show how one can add functions and tasks that are typed by the type system of the functional host language.

The DSL is clearly separated from its host functional language to facilitate the compilation to small executables in C++. The type system of the host language verifies the types in the DSL, including the types and proper use of variables. The DSL is extendable by new language constructs and interpretations without breaking any existing code. The type system guarantees that everything used in a DSL program is properly defined. We apply these techniques for a DSL to program Arduino microprocessor systems from Clean. The long term goal is to incorporate these microprocessors in the iTask system.


Type System Type Class Language Construct Functional Programming Language Host Language 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.



We thank the reviewers for their valuable feedback.


  1. 1.
    Alimarine, A.: Generic Functional Programming: Conceptual Design, Implementation and Applications. UB Radboud University Nijmegen (2003)Google Scholar
  2. 2. website (2015).
  3. 3. website (2015).
  4. 4.
    Augustsson, L.: Making edsls fly (2012).
  5. 5.
    Carette, J., Kiselyov, O., Shan, C.C.: Finally tagless, partially evaluated: tagless staged interpreters for simpler typed languages. J. Funct. Program. 19(5), 509–543 (2009)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Cheney, J., Hinze, R.: First-class phantom types. Technical report, Cornell University (2003)Google Scholar
  7. 7.
    Elliott, C., Finne, S., de Moor, O.: Compiling embedded languages. J. Funct. Program. 13(2), 455 (2003). Updated version of paper by the same name that appeared in SAIG2000 Proceedings. CrossRefzbMATHGoogle Scholar
  8. 8.
  9. 9.
    Gibbons, J.: Functional programming for domain-specific languages. In: Zsók, V., Horváth, Z., Csató, L. (eds.) CEFP 2013. LNCS, vol. 8606, pp. 1–28. Springer, Heidelberg (2015)Google Scholar
  10. 10.
    Gibbons, J., Wu, N.: Folding domain-specific languages: deep and shallow embeddings (functional pearl). SIGPLAN Not. 49(9), 339–347 (2014)MathSciNetCrossRefGoogle Scholar
  11. 11.
    Gill, A.: Domain-specific languages and code synthesis using haskell. Queue 12(4), 30:30–30:43 (2014)Google Scholar
  12. 12.
    hArduino.: package that allows haskell programs to control arduino boards using the Firmata protocol (2013).
  13. 13.
    Hudak, P.: Modular domain specific languages and tools. In: Proceedings of the 5th International Conference on Software Reuse. ICSR 1998, p. 134. IEEE Computer Society, Washington DC (1998)Google Scholar
  14. 14.
    Johann, P., Ghani, N.: Foundations for structured programming with gadts. SIGPLAN Not. 43(1), 297–308 (2008)CrossRefzbMATHGoogle Scholar
  15. 15.
    Koopman, P.: Functional semantics. In: Achten, P., Koopman, P. (eds.) The Beauty of Functional Code. LNCS, vol. 8106, pp. 60–78. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  16. 16.
    Leijen, D., Meijer, E.: Domain specific embedded compilers. SIGPLAN Not. 35(1), 109–122 (1999)CrossRefGoogle Scholar
  17. 17.
    Lindberg, R.: fpr-arduino: Functional Reactive Programming for the Arduino (2015).
  18. 18.
    Plasmeijer, R., Achten, P., Koopman, P.: iTasks: executable specifications of interactive work flow systems for the web. In: Hinze, R., Ramsey, N. (eds.) Proceedings of the ICFP 2007, pp. 141–152. ACM, Freiburg (2007)Google Scholar
  19. 19.
    Plasmeijer, R., Lijnse, B., Michels, S., Achten, P., Koopman, P.: Task-oriented programming in a pure functional language. In: Proceedings of the 14th Symposium on Principles and Practice of Declarative Programming. PPDP 2012, pp. 195–206. ACM, New York (2012)Google Scholar
  20. 20.
    Plasmeijer, R., van Eekelen, M.: Clean language report (version 2.1) (2002).
  21. 21.
    Schwaab, C., Pfeiffer, M., Brady, E.: Safety first: targeting embedded systems with full-spectrum dependent types, TFP 2015 Draft Proceedings (2015)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  1. 1.Institute for Computing and Information SciencesRadboud UniversityNijmegenThe Netherlands

Personalised recommendations