This is a tutorial on how Agda infers things.
There are two ways to read the tutorial:
- click this link to read the rendered HTML. Simple and sufficient, if you only want to read and not play with the code or contribute
- if you do want to play with the code, then install Agda, clone the repo, open the
InferenceInAgda.lagda.md
file, type check it and only then read
IMPORTANT: reading InferenceInAgda.lagda.md
without type checking the file beforehand is a non-option as making Agda color the code is important for understanding how things get type checked. Hence reading InferenceInAgda.lagda.md
directly on GitHub is a non-option as well as GitHub's syntax highlighting is insufficient and the file has to actually be type checked.
Building the HTML is a bit of a PITA as it requires several tools to be installed and several commands to be executed. So if you're going to create a PR, don't bother updating the HTML file, I'll do that myself.
- install
agda
and its standard library - install
htmlize
foremacs
. For example via(use-package htmlize :ensure t)
- install
agda-html-to-md
- install
pandoc
- add this to your
.emacs.d
file:
(global-set-key (kbd "C-x a h") 'htmlize-buffer)
(fset 'generate-inference-in-agda-html
[?\C-x ?h ?\C-u ?\M-| ?a ?g ?d ?a ?- ?h ?t ?m ?l ?- ?t ?o ?- ?m ?d return ?\C-x ?h ?\M-| ?p ?a ?n ?d ?o ?c ? ?- ?- ?t ?o ?c ? ?- ?s ? ?- ?o ? ?I ?n ?f ?e ?r ?e ?n ?c ?e ?I ?n ?A ?g ?d ?a ?. ?h ?t ?m ?l return])
(global-set-key (kbd "C-x a i") 'generate-inference-in-agda-html)
IMPORTANT: wait for each command to finish.
- open
InferenceInAgda.lagda.md
in emacs C-c C-l
(type check the file)C-x a h
(initial htmlization of the buffer)C-x a i
(generate the finalInferenceInAgda.html
file)