This is a bit of tangent, but I looked up Idris since I'd never heard of it. I'm currently learning Haskell and they look really similar. What differentiates the two? What can you do in one that you can't do in the other?
As practical matter, Idris is a new experimental language while Haskell is a mature, stable language with a useful standard library.
But fundamentally Idris is theoretically more advanced than Haskell. The core differences are
1. Idris functions can be proven to terminate (if you choose).
2. In Idris, types are first class values, and you can have dependent functions: functions whose return type depends on their input value.
An example of something you can do in Idris and not* in Haskell, in Idris you can define a vector type Vect n a, which is the type of vectors of length n with values in type a. You can also define Fin n, the set of integers less than n. Then you can define a function index : Fin n -> (Vect n a) -> a which takes an integer less than n, a vector of length n with element of type a, and returns an element of type a. This function is guaranteed to return a value, because the index is guaranteed to be in the correct range.
*For some meaning of "not": you can probably do this in some way in Haskell.
Yeah, you can definitely do that example in Haskell – if by Haskell you mean GHC. GHC has been slowly but surely adding dependently-typed features for quite some time now, which will culminate in a proper DependentTypes pragma sometime soon (for some meaning of soon, anyway).
There are a lot of other differences between Haskell and Idris, though. Totality is a pretty big thing, and Idris is also strict by default. It also has support for proof tactics, which I don't see Haskell getting anytime soon.
swatow|11 years ago
But fundamentally Idris is theoretically more advanced than Haskell. The core differences are
1. Idris functions can be proven to terminate (if you choose).
2. In Idris, types are first class values, and you can have dependent functions: functions whose return type depends on their input value.
An example of something you can do in Idris and not* in Haskell, in Idris you can define a vector type Vect n a, which is the type of vectors of length n with values in type a. You can also define Fin n, the set of integers less than n. Then you can define a function index : Fin n -> (Vect n a) -> a which takes an integer less than n, a vector of length n with element of type a, and returns an element of type a. This function is guaranteed to return a value, because the index is guaranteed to be in the correct range.
*For some meaning of "not": you can probably do this in some way in Haskell.
nbouscal|11 years ago
There are a lot of other differences between Haskell and Idris, though. Totality is a pretty big thing, and Idris is also strict by default. It also has support for proof tactics, which I don't see Haskell getting anytime soon.
andrzejsz|11 years ago
allenguo|11 years ago
> This means that whenever I call this function, I need to provide together with a and b a proof that b isn’t zero.
What might such a proof look like? And is this supposed to work at compile-time?