10Before installing Idris, you will need to make sure you have all
11of the necessary libraries and tools. You will need:
13- A fairly recent Haskell platform. Version 2013.2.0.0 should be
14 sufficiently recent, though it is better to be completely up to
17- The *GNU Multiple Precision Arithmetic Library* (GMP) is available
18 from MacPorts/Homebrew and all major Linux distributions.
20Downloading and Installing
21==========================
23The easiest way to install Idris, if you have all of the
24prerequisites, is to type:
28 cabal update; cabal install idris
30This will install the latest version released on Hackage, along with
31any dependencies. If, however, you would like the most up to date
32development version you can find it, as well as build intructions, on
33GitHub at: https://github.com/idris-lang/Idris-dev.
35To check that installation has succeeded, and to write your first
36Idris program, create a file called “``hello.idr``” containing the
44 main = putStrLn "Hello world"
46If you are familiar with Haskell, it should be fairly clear what the
47program is doing and how it works, but if not, we will explain the
48details later. You can compile the program to an executable by
49entering ``idris hello.idr -o hello`` at the shell prompt. This will
50create an executable called ``hello``, which you can run:
54 $ idris hello.idr -o hello
58Note that the ``$`` indicates the shell prompt! Should the Idris
59executable not be found please ensure that you have added
60``~/.cabal/bin`` to your ``$PATH`` environment variable. Mac OS X
61users may find they need to use ``~/Library/Haskell/bin``
62instead. Some useful options to the Idris command are:
64- ``-o prog`` to compile to an executable called ``prog``.
66- ``--check`` type check the file and its dependencies without
67 starting the interactive environment.
69- ``--help`` display usage summary and command line options
71The Interactive Environment
72===========================
74Entering ``idris`` at the shell prompt starts up the interactive
75environment. You should see something like the following:
77.. literalinclude:: ../listing/idris-prompt-start.txt
79This gives a ``ghci`` style interface which allows evaluation of, as
80well as type checking of, expressions; theorem proving, compilation;
81editing; and various other operations. The command ``:?`` gives a list
82of supported commands. Below, we see an example run in
83which ``hello.idr`` is loaded, the type of ``main`` is checked and
84then the program is compiled to the executable ``hello``. Type
85checking a file, if successful, creates a bytecode version of the file
86(in this case ``hello.ibc``) to speed up loading in future. The
87bytecode is regenerated if the source file changes.
90.. literalinclude:: ../listing/idris-prompt-helloworld.txt
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list