Reading 2 - Template Haskell

Due Monday 16 Sept @ 9 am

From this assignment, students will show...

Abstractions and Representations - Recall

by answering questions about Haskell Syntax represented as an Algebraic Data Type.

Technical Reading Comprehension - Recall

by answering questions about example programs that explore the problems of metaprogramming.

CodeGen and Metaprogramming - Recall

by answering questions about how the implementation interacts with the compiler.

Language FrontEnd Design - Recall

by answering questions about how a user writes metaprograms using templates and splices.

Note: We are approaching a level where simply copying and pasting the descriptions above will not satisfy your META.md requirements. At minimum, please tell me which questions correspond to which learning objective.

Let's begin

Note, the paper does talk about monads, specifically the Q monad, so it may be worthwhile to peek at the hw04-1 homework and come back to the paper if you get stuck.

Please answer questions in the Exemplars repo hw03-1-TemplateHaskell/questions.md (redundantly posted below) and submit to hw03-1/questions.md.

  1. What is compile-time meta-programming?
  2. What can compile-time meta-programming be used for?
  3. What is a splice and how is it notated in this paper?
  4. What is a quasi-quotation and how is it notated?
  5. How is the code a metaprogram generates represented? What interface for writing metaprograms is presented to the user?
  6. What is reification and why is it useful?
  7. Explain what the problem is in the cross2b function and why cross2a doesn’t have the same problem.
  8. Why is the code f x = $(zipN x) illegal at the top-level?
  9. What happens, and under what conditions, and when a Template Haskell program diverges for some input.
  10. Explain how Haskell processes groups of declarations that contain splices and why it adopts this approach.
  11. Explain how the function qIO :: IO a -> Q a makes it so compiling your program can delete your entire file store.
  12. What are original names and what are they used for?

META.md should include

  1. your name
  2. your utln
  3. how much time you spent on this assignment
  4. the witness "proof" for how you earned each learning objective

Please Submit

Contents to be submitted