{"id":17201375,"url":"https://github.com/timwspence/plfa","last_synced_at":"2026-01-05T15:40:40.625Z","repository":{"id":87371434,"uuid":"268485609","full_name":"TimWSpence/plfa","owner":"TimWSpence","description":"My code for PLFA","archived":false,"fork":false,"pushed_at":"2020-06-03T10:29:10.000Z","size":60451,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"dev","last_synced_at":"2025-01-30T08:23:45.543Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://plfa.github.io/","language":"Agda","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TimWSpence.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-01T09:59:32.000Z","updated_at":"2021-04-14T06:03:33.000Z","dependencies_parsed_at":"2023-06-27T03:23:06.888Z","dependency_job_id":null,"html_url":"https://github.com/TimWSpence/plfa","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimWSpence%2Fplfa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimWSpence%2Fplfa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimWSpence%2Fplfa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimWSpence%2Fplfa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimWSpence","download_url":"https://codeload.github.com/TimWSpence/plfa/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245431726,"owners_count":20614184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T02:11:39.967Z","updated_at":"2026-01-05T15:40:40.597Z","avatar_url":"https://github.com/TimWSpence.png","language":"Agda","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\nlayout: page\ntitle: Getting Started\npermalink: /GettingStarted/\n---\n\n\u003c!-- Links --\u003e\n\n[plfa]: http://plfa.inf.ed.ac.uk\n[plfa-dev]: https://github.com/plfa/plfa.github.io/archive/dev.zip\n[plfa-status]: https://travis-ci.org/plfa/plfa.github.io.svg?branch=dev\n[plfa-travis]: https://travis-ci.org/plfa/plfa.github.io\n[plfa-master]: https://github.com/plfa/plfa.github.io/archive/master.zip\n\n[agda]: https://github.com/agda/agda/releases/tag/v2.6.0.1\n[agda-version]: https://img.shields.io/badge/agda-v2.6.0.1-blue.svg\n[agda-docs-emacs-mode]: https://agda.readthedocs.io/en/v2.6.0.1/tools/emacs-mode.html\n[agda-docs-emacs-notation]: https://agda.readthedocs.io/en/v2.6.0.1/tools/emacs-mode.html#notation-for-key-combinations\n[agda-docs-package-system]: https://agda.readthedocs.io/en/v2.6.0.1/tools/package-system.html#example-using-the-standard-library\n\n[agda-stdlib-version]: https://img.shields.io/badge/agda--stdlib-v1.1-blue.svg\n[agda-stdlib]: https://github.com/agda/agda-stdlib/releases/tag/v1.1\n\n[haskell-stack]:  https://docs.haskellstack.org/en/stable/README/\n[haskell-ghc]: https://www.haskell.org/ghc/\n\n[mononoki]: https://madmalik.github.io/mononoki/\n\n[ruby]: https://www.ruby-lang.org/en/documentation/installation/\n[ruby-bundler]: https://bundler.io/#getting-started\n[ruby-jekyll]: https://jekyllrb.com/\n[ruby-html-proofer]: https://github.com/gjtorikian/html-proofer\n\n[kramdown]: https://kramdown.gettalong.org/syntax.html\n\n\n\u003c!-- Status \u0026 Version Badges --\u003e\n\n[![Build Status][plfa-status]][plfa-travis]\n[![Agda][agda-version]][agda]\n[![agda-stdlib][agda-stdlib-version]][agda-stdlib]\n\n\n# Getting Started with PLFA\n\n## Dependencies for users\n\nYou can read PLFA [online][plfa] without installing anything.\nHowever, if you wish to interact with the code or complete the exercises, you need several things:\n\n  - [Agda][agda]\n  - [Agda standard library][agda-stdlib]\n  - [PLFA][plfa-dev]\n\nPLFA is tested against specific versions of Agda and the standard library, which are shown in the badges above. Agda and the standard library change rapidly, and these changes often break PLFA, so using older or newer versions usually causes problems.\n\n### Installing Agda using Stack\n\nThe easiest way to install any specific version of Agda is using [Stack][haskell-stack]. You can get the required version of Agda from GitHub, either by cloning the repository and switching to the correct branch, or by downloading [the zip archive][agda]:\n```bash\ngit clone https://github.com/agda/agda.git\ncd agda\ngit checkout v2.6.0.1\n```\nTo install Agda, run Stack from the Agda source directory:\n```bash\nstack install --stack-yaml stack-8.6.5.yaml\n```\nIf you want Stack to use you system installation of GHC, you can pass the `--system-ghc` flag and select the appropriate `stack-*.yaml` file. For instance, if you have GHC 8.2.2 installed, run:\n```bash\nstack install --system-ghc --stack-yaml stack-8.2.2.yaml\n```\n\n### Installing the Standard Library and PLFA\n\nYou can get the required version of the Agda standard library from GitHub, either by cloning the repository and switching to the correct branch, or by downloading [the zip archive][agda-stdlib]:\n```bash\ngit clone https://github.com/agda/agda-stdlib.git\ncd agda-stdlib\ngit checkout v1.1\n```\nYou can get the latest version of Programming Language Foundations in Agda from GitHub, either by cloning the repository, or by downloading [the zip archive][plfa-dev]:\n```bash\ngit clone https://github.com/plfa/plfa.github.io\n```\nFinally, we need to let Agda know where to find the standard library. For this, you can follow the instructions [here][agda-docs-package-system].\n\nIt is possible to set up PLFA as an Agda library as well.  If you want to complete the exercises found in the `courses` folder, or to import modules from the book, you need to do this.  To do so, add the path to `plfa.agda-lib` to `~/.agda/libraries` and add `plfa` to `~/.agda/defaults`, both on lines of their own.\n\n\n## Setting up and using Emacs\n\nThe recommended editor for Agda is Emacs with `agda-mode`. Agda ships with `agda-mode`, so if you’ve installed Agda, all you have to do to configure `agda-mode` is run:\n```bash\nagda-mode setup\n```\n\nTo load and type-check the file, use [`C-c C-l`][agda-docs-emacs-notation].\n\n\nAgda is edited “interactively, which means that one can type check code which is not yet complete: if a question mark (?) is used as a placeholder for an expression, and the buffer is then checked, Agda will replace the question mark with a “hole” which can be filled in later. One can also do various other things in the context of a hole: listing the context, inferring the type of an expression, and even evaluating an open term which mentions variables bound in the surrounding context.”\n\nAgda is edited interactively, using “holes”, which are bits of the program that are not yet filled in. If you use a question mark as an expression, and load the buffer using `C-c C-l`, Agda replaces the question mark with a hole. There are several things you can to while the cursor is in a hole:\n\n    C-c C-c x    split on variable x\n    C-c C-space  fill in hole\n    C-c C-r      refine with constructor\n    C-c C-a      automatically fill in hole\n    C-c C-,      goal type and context\n    C-c C-.      goal type, context, and inferred type\n\nSee [the emacs-mode docs][agda-docs-emacs-mode] for more details.\n\nIf you want to see messages beside rather than below your Agda code, you can do the following:\n\n  - Open your Agda file, and load it using `C-c C-l`;\n  - type `C-x 1` to get only your Agda file showing;\n  - type `C-x 3` to split the window horizontally;\n  - move your cursor to the right-hand half of your frame;\n  - type `C-x b` and switch to the buffer called “Agda information”.\n\nNow, error messages from Agda will appear next to your file, rather than squished beneath it.\n\n\n### Auto-loading `agda-mode` in Emacs\n\nSince version 2.6.0, Agda has support for literate editing with Markdown, using the `.lagda.md` extension. One side-effect of this extension is that most editors default to Markdown editing mode, whereas\nIn order to have `agda-mode` automatically loaded whenever you open a file ending with `.agda` or `.lagda.md`, put the following on your Emacs configuration file:\n```elisp\n(setq auto-mode-alist\n   (append\n     '((\"\\\\.agda\\\\'\" . agda2-mode)\n       (\"\\\\.lagda.md\\\\'\" . agda2-mode))\n     auto-mode-alist))\n```\n\nThe configuration file for Emacs is normally located in `~/.emacs` or `~/.emacs.d/init.el`, but Aquamacs users might need to move their startup settings to the `Preferences.el` file in `~/Library/Preferences/Aquamacs Emacs/Preferences`.\n\n\n### Using mononoki in Emacs\n\nIt is recommended that you install the font [mononoki][mononoki], and add the following to the end of your emacs configuration file at `~/.emacs`:\n\n``` elisp\n;; default to mononoki\n(set-face-attribute 'default nil\n\t\t    :family \"mononoki\"\n\t\t    :height 120\n\t\t    :weight 'normal\n\t\t    :width  'normal)\n```\n\n\n### Unicode characters\n\nIf you're having trouble typing the Unicode characters into Emacs, the end of each chapter should provide a list of the unicode characters introduced in that chapter.\n\n`agda-mode` and emacs have a number of useful commands. Two of them are especially useful when you solve exercises.\n\nFor a full list of supported characters, use `agda-input-show-translations` with:\n\n    M-x agda-input-show-translations\n\nAll the supported characters in `agda-mode` are shown.\n\nIf you want to know how you input a specific Unicode character in agda file, move the cursor onto the character and type the following command:\n\n    M-x quail-show-key\n\nYou'll see the key sequence of the character in mini buffer.\n\n\n## Dependencies for developers\n\nBuilding PLFA is currently supported on Linux and macOS.\nPLFA is written in literate Agda with [Kramdown Markdown][kramdown].\nThe book is built in three stages:\n\n 1. The `.lagda.md` files are compiled to Markdown using Agda’s highlighter.\n    (This requires several POSIX tools, such as `bash`, `sed`, and `grep`.)\n\n 2. The Markdown files are converted to HTML using [Jekyll][ruby-jekyll], a widely-used static site builder.\n    (This requires [Ruby][ruby] and [Jekyll][ruby-jekyll].)\n\n 3. The HTML is checked using [html-proofer][ruby-html-proofer].\n    (This requires [Ruby][ruby] and [html-proofer][ruby-html-proofer].)\n\nMost recent versions of [Ruby][ruby] should work. The easiest way to install [Jekyll][ruby-jekyll] and [html-proofer][ruby-html-proofer] is using [Bundler][ruby-bundler]. You can install [Bundler][ruby-bundler] by running:\n```bash\ngem install bundler\n```\nYou can install the remainder of the dependencies---[Jekyll][ruby-jekyll], [html-proofer][ruby-html-proofer], *etc.*---by running:\n```bash\nbundle install\n```\nOnce you have installed all of the dependencies, you can build a copy of the book, and host it locally, by running:\n```bash\nmake build\nmake serve\n```\nThe Makefile offers more than just these options:\n```bash\nmake                      # see make test\nmake build                # builds lagda-\u003emarkdown and the website\nmake build-incremental    # builds lagda-\u003emarkdown and the website incrementally\nmake test                 # checks all links are valid\nmake test-offline         # checks all links are valid offline\nmake serve                # starts the server\nmake server-start         # starts the server in detached mode\nmake server-stop          # stops the server, uses pkill\nmake clean                # removes all ~unnecessary~ generated files\nmake clobber              # removes all generated files\n```\nIf you simply wish to have a local copy of the book, e.g. for offline reading, but don't care about editing and rebuilding the book, you can grab a copy of the [master branch][plfa-master], which is automatically built using Travis. You will still need [Jekyll][ruby-jekyll] and preferably [Bundler][ruby-bundler] to host the book (see above). To host the book this way, download a copy of the [master branch][plfa-master], unzip, and from within the directory run\n```bash\nbundle install\nbundle exec jekyll serve\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimwspence%2Fplfa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimwspence%2Fplfa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimwspence%2Fplfa/lists"}