Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f5193dd
corrections of formatting until chapter 10 inclusive
winitzki Feb 16, 2026
9f2a6b9
corrections in chapter 11
winitzki Feb 16, 2026
d4ef9a9
corrections in chapter 15
winitzki Feb 16, 2026
7de750b
finished formatting corrections, implement chapter / section references
winitzki Feb 16, 2026
d9ad460
implement chapter/section references
winitzki Feb 16, 2026
17a0d13
fix references
winitzki Feb 16, 2026
a8b9a7b
more fixes for formatting
winitzki Feb 16, 2026
2c956f9
some fixes
winitzki Feb 16, 2026
1c1ddf1
wip trying to add titleback
winitzki Feb 16, 2026
c4f94d7
include title-back material
winitzki Feb 17, 2026
db9bc95
wip
winitzki Feb 17, 2026
4275ed4
wip
winitzki Feb 17, 2026
cde3523
final corrections in chapter 1
winitzki Feb 18, 2026
4f49c61
starting corrections in chapter 2
winitzki Feb 18, 2026
38bbc94
finish corrections in chapter 2
winitzki Feb 18, 2026
9ca9922
finish corrections in chapter 3
winitzki Feb 18, 2026
56f1f98
wip
winitzki Feb 18, 2026
33040f2
corrections in chapter 4
winitzki Feb 18, 2026
e3da62c
corrections in chapter 4, beginning chapter 5
winitzki Feb 19, 2026
ca4db21
wip
winitzki Feb 19, 2026
ad74423
wip corrections in chapter 5
winitzki Feb 19, 2026
82b1888
wip
winitzki Feb 20, 2026
a3a243f
corrections in chapter 5
winitzki Feb 20, 2026
4f2c97d
wip
winitzki Feb 20, 2026
0580382
corrections in chapter 6
winitzki Feb 21, 2026
559bf81
remove junk before page 0
winitzki Feb 21, 2026
758d7b3
wip corrections in chapter 8
winitzki Feb 23, 2026
6bf1ca4
corrections in chapter 8
winitzki Feb 23, 2026
144287a
begin corrections in chapte r9
winitzki Feb 23, 2026
d11d859
further corrections in chapter 9
winitzki Feb 23, 2026
05513c7
corrections in chapter 9
winitzki Feb 24, 2026
099ac96
corrections in chapter 10
winitzki Feb 24, 2026
65de9da
corrections in chapter 11
winitzki Feb 24, 2026
8a06885
corrections in chapter 12, 13
winitzki Feb 25, 2026
212b80a
corrections in chapter 14
winitzki Feb 25, 2026
38c40e7
wip chapter 15 corrections
winitzki Feb 25, 2026
4763e9f
corrections in chapter 15
winitzki Feb 25, 2026
16f16bf
corrections in chapter 17
winitzki Feb 25, 2026
356cbe3
wip corrections in chapter 19
winitzki Feb 25, 2026
9d5a48f
wip appendix corrections
winitzki Feb 25, 2026
ddd636f
corrections in appendix A
winitzki Feb 25, 2026
7f0e043
wip appendix b
winitzki Feb 25, 2026
052a63b
wip
winitzki Feb 25, 2026
91aba0e
wip appendix b
winitzki Feb 25, 2026
2cecba9
finished all corrections
winitzki Feb 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- Implement a type-checker that can modify the expression being type checked. The new expression may have some arguments inserted and some type annotations inserted, etc.
- Implement "one-step" type inference for ∀-spines using that feature. (Not sure whether also λ-spines are required for this to work.) Modify the do-notation by using type inference.
- Implement some more beta-reducing rules. For example, `Integer/clamp (Integer/clamp x) = Integer/clamp x`, distribute functions such as `List/head` over `if/then/else` when there is opportunity to simplify, or some more rules for `Natural` number operations. I documented some possible new rules in the scall source code. For example, also `(if a then b else c).d` in case `b` and `c` are literal records, or `Integer/negate (Integer/negate x) = x`.
- At type-checking stage, automatically insert values of the unit type `{}` when needed, similarly to the one-step type inference. Values of the type `{}` will be also inserted when their type was computed depending on previous values. Similarly, insert values of equality types.
- At type-checking stage, automatically insert values of the unit type `{}` when needed, similarly to the one-step type inference. Values of the type `{}` will be also inserted when their type was computed depending on previous values. Similarly, insert values of equality types. Investigate if we could automatically convert between types `{} → a` and `a` at any usage site.
- Each expression has a built-in "type annotation" field that may be initially empty. Implement the beta-reducer that can use the type information. If type information is not present, certain "type-sensitive" beta-reductions will not be performed (but others will be). For example, implement the reduction `{ a = x.a } = x` when `x` is a record containing the single field `a`, and similarly with `merge`. Make sure we can symbolically validate monoid laws, state monad laws, etc., which we can't do without such reduction rules. This is low priority because those kinds of reductions are only seen under lambda and not when evaluating concrete literal values.
- Revisit the standard library's `List` module and implement a better choice of a `List` index built-in. Maybe slicing or direct indexing? Try avoiding the explosion of normal forms.
- Implement more features for dependent type checking. Add a "value context" to the typechecker and to the beta reducer. (See below.)
Expand Down
2 changes: 1 addition & 1 deletion tutorial/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ programming_dhall.pdf: generated.tex programming_dhall.tex
( makeindex programming_dhall.idx || true ; pdflatex --interaction=batchmode programming_dhall.tex || true) >& /dev/null
fgrep "Output written on programming_dhall.pdf" programming_dhall.log

generated.tex: programming_dhall.md convertMd.sh convertMd.scala
generated.tex: programming_dhall.md titleback.tex convertMd.sh convertMd.scala
bash convertMd.sh tex ../dhall-lang/Prelude

generated.dhall: programming_dhall.md convertMd.sh convertMd.scala
Expand Down
30 changes: 29 additions & 1 deletion tutorial/convertMd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,40 @@ def toLatex: Markdown => String = {
case Markdown.BlankLine => "\n"
}

val hardcodedReplacements : String => String = { (source : String) =>
Seq(
"\\$x0\\$" -> "\\$x_0\\$",
"(\\\\log)\\{(.*)\\} " -> "$1 _{$2} ",
"[tT]he +chapter +\"([^\"]+)\"" -> "Chapter \\\\ref{$1}",
"[cC]hapter +\"([^\"]+)\"" -> "Chapter \\\\ref{$1}",
"[tT]he [Aa]ppendix +\"([^\"]+)\"" -> "Appendix \\\\ref{$1}",
"[Aa]ppendix +\"([^\"]+)\"" -> "Appendix \\\\ref{$1}",
"[sS]ection \"([^\"]+)\"" -> "Section \\\\ref{$1}",
"[tT]he +section \"([^\"]+)\"" -> "Section \\\\ref{$1}",
"[tT]he +subsection \"([^\"]+)\"" -> "Subsection \\\\ref{$1}",
"(\\\\label\\{)Appendix: " -> "$1",
// "'s" -> "\\\\textsf{'}s", // Leads to junk before page 0 of the book.
// "O'" -> "O\\\\textsf{'}",
// "s'" -> "s\\\\textsf{'}",
//"``" -> "\\\\textsf{``}",
"“" -> "\\textsf{``}",
//"''" -> "\\\\textsf{''}",
"”" -> "\\\\textsf{''}",
//"\\\\textsf\\{'\\}'" -> "\\\\textsf{''}",
//"\"([a-zA-Z])" -> "\\\\textsf{``}$1",
// "([a-zA-Z])\"" -> "$\\\\textsf{``}",
).foldLeft(source) { case (prev, (from, to)) => prev.replaceAll(from, to) }
}




@main
def main(code: Boolean, preludePath: String): Unit =
val result: Seq[Markdown] = parse(System.in, markdown(using _)).get.value
// The syntax `using _` was suggested as a workaround in https://github.com/scala/scala3/issues/19872

val convert = if code then toDhall(preludePath) else toLatex
val convert = if code then toDhall(preludePath) else (toLatex andThen hardcodedReplacements)
val sep = if code then "" else "\n"

println(result.map(convert).mkString(sep))
Loading
Loading