A simple, functional programming language in the ML tradition
Amulet is a simple, modern programming language based on the long tradition of the ML family, bringing improvements from the cutting-edge of programming language research.
Amulet's type system supports many advanced features, including but not limited to:
let map f = function (* 1 *) | [] -> [] | Cons (x, xs) -> Cons (f x, map f xs) (* 2 *) let filter p xs = [ x | with x <- xs, p x ] (* 3 *)
in
and other noise is entirely optional. type vect 'n 'a = (* 1 *) | Nil : vect Z 'a (* 2 *) | Cons : forall 'a. 'a * vect 'n 'a -> vect (S 'n) 'a (* 3 *) let rec map (f : 'a -> 'b) (xs : vect 'n 'a) : vect 'n 'b = match xs with | Nil -> Nil | Cons (x, xs) -> Cons (f x, map f xs)
type function 'n :+ 'k begin (* 1 *) Z :+ 'n = 'n (* 2 *) (S 'n) :+ 'k = S ('n :+ 'k) (* 3 *) end let rec append (xs : vect 'n 'a) (ys : vect 'k 'a) : vect ('n :+ 'k) 'b = match xs with | Nil -> ys | Cons (x, xs) -> Cons (x, append xs ys)