Skip to content

Commit d8e7cb5

Browse files
committed
Start on tagless final
1 parent 8f42d48 commit d8e7cb5

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

build.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ lazy val pages = List(
133133
"indexed-types/codata.md",
134134
"indexed-types/data.md",
135135
"indexed-types/conclusions.md",
136+
// Tagless Final
137+
"tagless-final/index.md",
136138
// Interpreter optimization
137139
"adt-optimization/index.md",
138140
"adt-optimization/algebra.md",

src/pages/codata/extensibility.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Data and Codata Extensibility
1+
## Data and Codata Extensibility {#sec:codata:extensibility}
22

33
We have seen that codata can represent types with an infinite number of elements, such as `Stream`. This is one expressive difference from data, which must always be finite. We'll now look at another, which is the type of extensibility we get from data and from codata. Together these gives use guidelines to choose between the two.
44

src/pages/tagless-final/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Tagless Final Interpreters
2+
3+
We've seen the duality between data and codata in many places, starting in [@sec:codata], but we haven't yet explored interpreters that use the codata approach. In this chapter we'll do so, looking at a strategy known as **tagless final**.
4+
5+
Tagless final is a little bit more than a straightforward application of the data-codata duality.
6+
In particular, it solves a problem around extensibility known as the **expression problem**.
7+
We first met this problem in [@sec:codata:extensibility].
8+
In the context of interpreters, solving the expression problem allowing extensibility of both the programs we write and the interpreters that run them.
9+
10+
We'll start this chapter looking at codata interpreters.
11+
We'll see they have a shortcoming, which motivates the expression problem.
12+
13+
Solving the expression problem allows for very expressive code, as the name suggests.

0 commit comments

Comments
 (0)