Introduction | Examples | Documentation | Download
Idris is an experimental language with full dependent types. Dependent types allow types to be predicated on values, meaning that some aspects of a program's behaviour can be specified precisely in the type. The language is closely related to Epigram and Agda.
The aims of the project are:
Future plans include some more useful syntax (local definitions/where clauses being the most important), a compiler, links to the Ivor theorem prover and pluggable decision procedures.
See darcs repository. You can also look there for library code. Some particular things worth looking at are:
mkPartitionR).
fPlus and fPlusInf. They need
some type information, because terms are defined with respect to an
environment. fPlus does this by explicitly stating the
type, fPlusInf just provides a starting environment which
is actually all the type checker needs.
do notation.
fork and some locking
functions will help.
Imagine there is some documentation here. Take a look at some code samples until it appears!
To load a program foo.idr, enter idris
foo.idr at the shell prompt. You can then enter expressions to
be evaluated. An expression of type IO a for some
a will be executed (slowly, at the moment). You may get
error messages, which will probably be incomprehensible. I will deal
with this soon too...
Some notes on some less obvious features will be useful, however:
# is the type of types.
(x:A)->B, or
A->B if x does not appear free in
B.
a=b. There is no need for
a and b to be the same type. refl
a is an instance of a=a.
() with one instance, II.
_|_ with no instances.
Int and String as normal, and
Bool with constructors True and False.
Lock for
semaphores, Handle for files.
If a name appears in a type without being declared, it is made
implicit and its type must be inferrable. e.g. in
f:Nat -> (B x)
then assuming the type of B is known
(e.g. B:Nat->#), then the type of x is
inferrable and should not be written down when
f is called, e.g.
f (S O).
If you want to make x explicit
with some value y, write the call as
f {x=y} (S O).
Implicit arguments can also
be written down explicitly, e.g. in
f:{x:Nat}->Nat->(B x),
x is implicit --- this is identical to the declaration
above.
+,-,*,/. String
concatenation is ++. Comparison operators, which return
a Bool, are <,
>, <=, >= and ==.
- There is Haskell style
do notation for the
IO monad, e.g:
do {
x <- getStr;
putStrLn x;
}
You can download the source from the following places:
Requires GHC version 6.10 or greater to build; earlier versions should work but will need some fiddling.
You'll also need Ivor the Proof Engine. I will at some point make a release that collects all the non-standard stuff you need into one tarball.
Edwin Brady -- eb@dcs.st-and.ac.uk -- 20th July 2009