Presented at the Haskell Implementers Workshop 2022: https://icfp22.sigplan.org/home/hiw-2022#About
Video: TBD
Haskell's strong static typing and the ease at which the programmer can create and manipulate algebraic data types make it a good choice for implementing (embedded) programming languages. However a common problem with deeply embedded languages is that there is no strong connection between the source program the user writes; the abstract syntax tree that is generated for that embedded program; and the object code that is eventually generated, complied, and executed for that program. Once the embedded language moves beyond the prototype phase, this disconnect makes it almost impossible for a user to debug their program or determine where the execution time is being spent.
In this talk we discuss recent work on annotating the abstract syntax tree of the deeply embedded languages Accelerate. We present our approach for automatically gathering source location information for embedded expressions using a novel implicit-parameter based approach. Unlike the existing HasCallStack
mechanism provided by GHC, our approach statically ensures that the required source location information is available when needed. Annotating the abstract syntax tree of the program with this information, it is now possible to map the embedded program back to the original source code. We demonstrate our current progress on using this information to improve compiler diagnostics, as well as enable profiler and debugger integration for embedded programs.