The Agda package

[Tags:library, program]

Agda is a dependently typed functional programming language: It has inductive families, which are similar to Haskell's GADTs, but they can be indexed by values and not just types. It also has parameterised modules, mixfix operators, Unicode characters, and an interactive Emacs interface (the type checker can assist in the development of your code).

Agda is also a proof assistant: It is an interactive system for writing and checking proofs. Agda is based on intuitionistic type theory, a foundational system for constructive mathematics developed by the Swedish logician Per Martin-Löf. It has many similarities with other proof assistants based on dependent types, such as Coq, Epigram and NuPRL.

Note that if you want to use the command-line program (agda), then you should also install the Agda-executable package. The Agda package includes an Emacs mode for Agda, but you need to set up the Emacs mode yourself (for instance by running agda-mode setup; see the README).

Note also that this library does not follow the package versioning policy, because the library is only intended to be used by the Emacs mode and the Agda-executable package.

[Skip to Readme]


Versions 2.2.0, 2.2.2, 2.2.4, 2.2.6, 2.2.8, 2.2.10, 2.3.0,, 2.3.2,,, 2.4.0,,, 2.4.2,,,,,, 2.5.1
Dependencies array (>=0.1 && <1), base (>=4.1 && <4.4), binary (>=0.4.4 && <0.6), bytestring (>= && <1), containers (>=0.1.0 && <1), directory (>=1.0 && <1.2), filepath (>=1.1 && <2), haskeline (>= && <0.7), haskell-src-exts (>=1.9.6 && <1.10), mtl (==2.0.*), old-time (==1.*), pretty (==1.*), process (>= && <2), QuickCheck (>=2.3 && <2.5), syb (>=0.1 && <0.3), utf8-string (==0.3.*), xhtml (==3000.2.*), zlib (>= && <1) [details]
License OtherLicense
Author Ulf Norell, Nils Anders Danielsson, Catarina Coquand, Makoto Takeyama, Andreas Abel, Darin Morrison...
Maintainer Ulf Norell <>
Stability Unknown
Category Dependent types
Home page
Bug tracker
Source repository head: darcs get
this: darcs get --tag 2.2.10
Uploaded Sun Feb 20 17:33:32 UTC 2011 by NilsAndersDanielsson
Distributions Arch:2.5.1, Debian:, Fedora:, FreeBSD:, LTSHaskell:2.5.1, NixOS:2.5.1, Stackage:2.5.1
Downloads 13064 total (86 in the last 30 days)
1 []
Status Docs uploaded by user
Build status unknown [no reports yet]




use-localeTry to use the character encoding specified by the locale for most of the IO going to/from stdin and stdout. (Note that source files must always be encoded using UTF8.)EnabledAutomatic
epicInstall the Epic compiler.DisabledManual

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

For package maintainers and hackage trustees

Readme for Agda

Readme for Agda-2.2.10

Agda 2

Table of contents:

* Installing Agda
* Configuring the Emacs mode
* Prerequisites
* Installing the Epic backend's dependencies
* Installing a suitable version of Emacs under Windows

Installing Agda

  Note that this README only discusses installation of Agda, not its
  standard library. See the Agda Wiki for information about the

There are several ways to install Agda:

* Using a binary package, prepared for your platform.

  Recommended if such a package exists. See the Agda Wiki.

* Using a released source package, available from Hackage.

  (Note that if you want to install the development version of Agda,
  then you should use the next method.)

  Install the prerequisites mentioned below, then run the following

    cabal update
    cabal install Agda-executable
    agda-mode setup

  The last command tries to set up Emacs for use with Agda. As an
  alternative you can copy the following text to your .emacs file:

    (load-file (let ((coding-system-for-read 'utf-8))
                    (shell-command-to-string "agda-mode locate")))

* Using the source tar balls available from the Agda Wiki, or the
  development version of the code available from our darcs repository.

  1)  Install the prerequisites mentioned below.

  2a) Run the following commands in the top-level directory of the
      Agda source tree:

        cabal update
        cabal install
        agda-mode setup
        cd src/main
        cabal install

      The third command tries to set up Emacs for use with Agda. As an
      alternative you can copy the following text to your .emacs file:

        (load-file (let ((coding-system-for-read 'utf-8))
                        (shell-command-to-string "agda-mode locate")))

      If you want to have more control over where files are installed
      then you can give various flags to cabal install, see
      cabal install --help.

  2b) Instead of following 2a you can try to install Agda (including
      batch-mode tool and Emacs mode) by running the following

        make install

Configuring the Emacs mode

If you want to you can customise the Emacs mode. Just start Emacs and
type the following:

   M-x load-library RET agda2-mode RET
   M-x customize-group RET agda2 RET

This is useful if you want to change the Agda search path, in which
case you should change the agda2-include-dirs variable.

If you want some specific settings for the Emacs mode you can add them
to agda2-mode-hook. For instance, if you do not want to use the Agda
input method (for writing various symbols like ∀≥ℕ→π⟦⟧) you can add
the following to your .emacs:

(add-hook 'agda2-mode-hook
          '(lambda ()
             ; If you do not want to use any input method:
             ; If you want to use the X input method:
             (set-input-method "X")

Note that, on some systems, the Emacs mode changes the default font of
the current frame in order to enable many Unicode symbols to be
displayed. This only works if the right fonts are available, though.
If you want to turn off this feature, then you should customise the
agda2-fontset-name variable.


You need recent versions of the following programs/libraries:

   GNU Emacs:

You should also make sure that programs installed by cabal-install are
on your shell's search path.

For instructions on installing a suitable version of Emacs under
Windows, see below.

Non-Windows users need to ensure that the development files for the C
libraries zlib and ncurses are installed (see and Your package manager may be
able to install these files for you. For instance, on Debian or Ubuntu
it should suffice to run

  apt-get install zlib1g-dev libncurses5-dev

as root to get the correct files installed.

Installing the Epic backend's dependencies

The Epic backend is experimental and requires that the Epic program is
installed. You can install this program by giving the epic flag to

* When installing from Hackage:

    cabal update
    cabal install Agda -fepic
    cabal install Agda-executable
    agda-mode setup

* When installing using a source tar ball, following the instructions
  in 2a) above:

    cabal update
    cabal install -fepic
    agda-mode setup
    cd src/main
    cabal install

* When installing using a source tar ball, following the instructions
  in 2b) above:

    make CABAL_OPTIONS="--global -fepic" install

  (The Makefile specifies CABAL_OPTIONS=--global by default; feel free
  to omit --global.)

You can also install Epic directly:

  cabal install epic

Note that Epic depends on other software:

  The Boehm garbage collector:
  The GNU Multiple Precision Arithmetic Library:
  GCC, the GNU Compiler Collection:

For more information about Epic:

Installing a suitable version of Emacs under Windows

Note that Agda code often uses mathematical and other symbols
available from the Unicode character set. In order to be able to
display these characters you may want to follow the procedure below
when installing Emacs under Windows.

1. Install NTEmacs 22.

   Download from
   the self-extracting executable

   When executed, it asks where to extract itself.  This can be
   anywhere you like, but here we write the top directory for ntemacs as
   in the following.

   What follows is tested only on this version.  Other versions may
   work but you have to figure out yourself how to use Unicode fonts
   on your version.

2. Install ucs-fonts and mule-fonts for emacs.

   Download from
   the tar file
   Let us write the top directory of extracted files as
   Next we create some derived fonts.
       cd c:/pkg/ucs-fonts/submission
       make all-bdfs
   This gives an error message about missing fonts, but ignore it.

   Download from
   the tar file
   The untarred top directory is named "packages", but we are only
   interested in the subdirectory "packages/fonts".  Let us assume
   we moved this subdirectory to

   Add the following to your .emacs

;;;;;;;;; start of quoted elisp code

(setq bdf-directory-list

(setq w32-bdf-filename-alist
      (w32-find-bdf-fonts bdf-directory-list))

    chinese-gb2312:-ISAS-Fangsong ti-Medium-R-Normal--16-160-72-72-c-160-GB2312.1980-0,
    " t)

(setq font-encoding-alist
      (append '(
                ("JISX0208" (japanese-jisx0208 . 0))
                ("JISX0212" (japanese-jisx0212 . 0))
                ("CNS11643.1992.1-0" (chinese-cns11643-1 . 0))
                ("GB2312" (chinese-gb2312 . 0))
                ("KSC5601" (korean-ksc5601 . 0))
                ("VISCII" (vietnamese-viscii-lower . 0))
                ("MuleArabic-0" (arabic-digit . 0))
                ("MuleArabic-1" (arabic-1-column . 0))
                ("MuleArabic-2" (arabic-2-column . 0))
                ("muleindian-1" (indian-1-column . 0))
                ("muleindian-2" (indian-2-column . 0))
                ("MuleTibetan-0" (tibetan . 0))
                ("MuleTibetan-1" (tibetan-1-column . 0))
                ) font-encoding-alist))

;;;;;;; end of quoted elisp code

   To test the fonts, try

       M-x eval-expression RET
       (set-default-font "fontset-bdf") RET
       M-x view-hello-file

   You should see all the characters without white-boxes.