1\section{Getting Started}
3\subsection{Prerequisites}
5Before installing \Idris{}, you will need to make sure you have all of the necessary
6libraries and tools. You will need:
9\item A fairly recent Haskell platform. Version 2010.1.0.0.1 is currently
11\item The Boehm-Demers-Weiser garbage collector library. This is available in
12all major Linux distributions, or can be installed from source, available
13from \url{http://www.hpl.hp.com/personal/Hans_Boehm/gc/}. Installing from
14source is painless on MacOS.
15\item The GNU multiprecision arithmetic library, GMP, available from MacPorts and
16all major Linux distributions.
19\subsection{Downloading and Installing}
21The easiest way to install \Idris{}, if you have all of the prerequisites, is to type:
23\begin{SaveVerbatim}{install}
31This will install the latest version released on Hackage\footnote{However version 0.9, which
32this tutorial describes, is not yet there, so don't do this. Finishing this tutorial is the
33last requirement before releasing it :-).}, along with any dependencies.
34If, however, you would like the most up
35to date development version, you can find it on GitHub at
36\url{https://github.com/edwinb/Idris-dev}.
38To check that installation has succeeded, and to write your first \Idris{}
39program, create a file called ``\texttt{hello.idr}'' containing the following
42\begin{SaveVerbatim}{hello}
47main = putStrLn "Hello world";
53If you are familiar with Haskell, it should be fairly clear what the program is doing
54and how it works, but if not, we will explain the details later.
55You can compile the program to an executable by entering \texttt{idris hello.idr -o hello}
56at the shell prompt. This will create an executable called \texttt{hello}, which you can run:
58\begin{SaveVerbatim}{hello}
60$ idris hello.idr -o hello
68Note that the \texttt{\$} indicates the shell prompt! Some useful options to the
69\texttt{idris} command are:
72\item \texttt{-o prog} to compile to an executable called \texttt{prog}.
73\item \texttt{--check} type check the file and its dependencies without starting the
74interactive environment.
77\subsection{The interactive environment}
79Entering \texttt{idris} at the shell prompt starts up the interactive
80environment. You should see something like the following:
82\begin{SaveVerbatim}{prompt1}
87 / // __ / ___/ / ___/ Version 0.9
88 _/ // /_/ / / / (__ ) http://www.idris-lang.org/
89 /___/\__,_/_/ /_/____/ Type :? for help
98This gives a \texttt{ghci}-style interface which allows evaluation of expressions,
99as well as type checking expressions, theorem proving, compilation, editing
100and various other operations. \texttt{:?} gives a list of supported commands,
101as shown in Figure \ref{cmds}. Figure \ref{run1} shows an example run in which
102\texttt{hello.idr} is loaded, the type of \texttt{main} is checked and then
103the program is compiled to the executable \texttt{hello}.
105\begin{SaveVerbatim}{cmds}
109 Command Arguments Purpose
111 <expr> Evaluate an expression
112 :t <expr> Check the type of an expression
113 :r :reload Reload current file
114 :e :edit Edit current file using $EDITOR or $VISUAL
115 :m :metavars Show remaining proof obligations (metavariables)
116 :p :prove <name> Prove a metavariable
117 :a :addproof Add last proof to source file
118 :c :compile <filename> Compile to an executable <filename>
119 :exec :execute <filename> Compile to an executable <filename> and run
120 :? :h :help Display this help text
121 :q :quit Exit the Idris system
123\codefigs{cmds}{Interactive environment commands}
126\begin{SaveVerbatim}{run1}
130 / _/___/ /____(_)____
131 / // __ / ___/ / ___/ Version 0.9
132 _/ // /_/ / / / (__ ) http://www.idris-lang.org/
133 /___/\__,_/_/ /_/____/ Type :? for help
135Type checking ./hello.idr
146\codefig{run1}{Sample interactive run}
148Type checking a file, if successful, creates a bytecode version of the file (in this
149case \texttt{hello.ibc}) to speed up loading in future. The bytecode is regenerated if
150the source file changes.
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