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 sufficiently recent, though it is better to be completely up to date.
15- The *GNU Multiple Precision Arithmetic Library* (GMP) is available from MacPorts/Homebrew and all major Linux distributions.
17Downloading and Installing
18==========================
20The easiest way to install Idris, if you have all of the
21prerequisites, is to type:
25 cabal update; cabal install idris
27This will install the latest version released on Hackage, along with
28any dependencies. If, however, you would like the most up to date
29development version you can find it, as well as build intructions, on
30GitHub at: https://github.com/idris-lang/Idris-dev.
32To check that installation has succeeded, and to write your first
33Idris program, create a file called ``hello.idr`` containing the
41 main = putStrLn "Hello world"
43If you are familiar with Haskell, it should be fairly clear what the
44program is doing and how it works, but if not, we will explain the
45details later. You can compile the program to an executable by
46entering ``idris hello.idr -o hello`` at the shell prompt. This will
47create an executable called ``hello``, which you can run:
51 $ idris hello.idr -o hello
55Please note that the dollar sign ``$`` indicates the shell prompt!
56Should the Idris executable not be found please ensure that you have
57added ``~/.cabal/bin`` to your ``$PATH`` environment variable. Mac OS
58X users may find they need to add ``~/Library/Haskell/bin``
59instead. Some useful options to the Idris command are:
61- ``-o prog`` to compile to an executable called ``prog``.
63- ``--check`` type check the file and its dependencies without starting the interactive environment.
65- ``--help`` display usage summary and command line options.
67The Interactive Environment
68===========================
70Entering ``idris`` at the shell prompt starts up the interactive
71environment. You should see something like the following:
73.. literalinclude:: ../listing/idris-prompt-start.txt
75This gives a ``ghci`` style interface which allows evaluation of, as
76well as type checking of, expressions; theorem proving, compilation;
77editing; and various other operations. The command ``:?`` gives a list
78of supported commands. Below, we see an example run in
79which ``hello.idr`` is loaded, the type of ``main`` is checked and
80then the program is compiled to the executable ``hello``. Type
81checking a file, if successful, creates a bytecode version of the file
82(in this case ``hello.ibc``) to speed up loading in future. The
83bytecode is regenerated if the source file changes.
86.. 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