Template Haskell - Paper Discussion
From doing these activities students will
- Master vocabulary used by programming language designers
- Reason about a technique for code reuse and reducing boilerplate
- Clarify the boundary of what can be metaprogrammed at compile time and what
must wait for more runtime information
In class Announcements - 5 min (9:00 ~ 9:05)
Warm-up activity - 5 min (9:05 ~ 9:10)
You will be given a vocabulary word in class on a piece of paper.
Add a definition for it to the Vocabulary wiki page in the Reading repository.
Groups and Roles
Scribes
- Take notes for your group to contribute to the wiki page for the discussion
- A head scribe will go and write a summary on that page for an extra credit point
Managers
- Keep track of time
- Make a role ticket on the Reading repo for everyone in your group
Ambassadors
- Presents the unified thoughts of their group
- Talks with instructors at the end about meta class management
Small group discussion - 30 min (9:10 ~ 9:40)
All groups answer the following discussion questions:
- What are the advantages and disadvantages of having the language that
executes at compile time be the same as the language that executes at run time?
- What are the three layers of Template Haskell and how do they relate to each other? What are the advantages and disadvantages of using each layer?
- What does the type of sel (sel :: Int -> Int -> Expr ) say about generated code? What doesn't it say? Could the type be made more precise? Why or why not?
- Template Haskell adopts the principle that every occurence of a variable is bound to the value that is lexically in scope at the occurence site in the original source program, before any template expansion. Give examples to illustrate why this property is tricky to guarantee. How do the designers of Template Haskell ensure this property?
Useful Template Haskell documentation as it is currently implemented
Large group discussion - 20min (9:40 ~ 10:00)
Ambassadors will take turns discussing their group's answers to the questions before
opening the floor to the rest of the class
Cool-down activity - 15 min (10:00 ~ 10:15)
All scribes will get together to start their wiki write up to be finished
at latest a week from today.
All managers will get together and make tickets for the course.
This can include the tickets from their group discussions as mentioned above,
a ticket to follow up on the scribe write up, and any other issues they
think will be helpful.
All ambassadors will get together with Matthew and Kathleen and discuss how they think
the day went, how they think the pacing went, what they are looking forward to, any
worries they might have about the class, etc.
Class Dismissed
Please do Wednesday's coding assignment before next class.