Oden is an experimental, statically typed, functional programming language, built for the Go ecosystem. Oden is no longer under active development!

package main

// Oden has ad-hoc polymorphism through records.
impl Monoid({x : int, y: int}) {
	Apply(p1, p2 ) = { x = p1.x + p2.x, y = p1.y + p2.y }  
}

// Types can be inferred by Oden. Here we also use the overloaded ++ function which
// is an alias for Monoid::Apply.
move(p) = p ++ { x = 10, y = 20 }

// You can explictly annotate the types. We use records and the
// block expression here (for demo purposes).
printPoint : forall r. { x : int, y : int | r } -> ()
printPoint(p) = {
	print(p.x)
	print(", ")
	print(p.y)
}

// Oden supports higher-order functions and polymorphic functions.
twice : forall a. (a -> a) -> a -> a
twice(f, x) = f(f(x))

// We begin our programs in the 'main' function, which always has type '-> ()'.
main : -> ()
main() = printPoint(twice(move, { x = 5, y = 10 }))

Overview

  • Static type system with support for polymorphism
  • Simple syntax (work in progress, expect changes)
  • Expressions instead of statements
  • Simple interoperability with Go (work in progress)
  • From Go:
    • Static linking
    • Cross-compilation
    • Goroutines (not done yet)
    • Channels (not done yet)
    • Library Ecosystem

Project Status

Oden is since Oct 10th, 2016 not in active development any more. Read more at Taking a Step Back from Oden.

Want to learn more?

Dive right into the User Guide to get started!