Par

A statically-typed, functional language focused on usability.

Hindley-Milner type inference
Your code looks dynamically-typed, but types are inferred and checked. Enjoy safety with few type annotations.

Succinct function composition
Express complex operations by composing functions, using partial application and higher-order constructs.

Immutable data structures
Functions return new data structures, so it's easy to reason about
your code. Common operations like filter, map, and fold work
with lists, sets, and maps thanks to interfaces.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  | import String (*) import List (*) // Returns the n most common words in text, sorted by // frequency descending. common_words(n, text) = let words = split(text, re(`\W+`, [])) |> map(to_lower) let freqs = fold( words, {}, Map.upsert(_, _, 0, |f| f + 1) ) unique(words) |> sort_by(|word| -get(freqs, word)) |> take(n)  | 

Also Featuring
- Algebraic data types
 - Exhaustive pattern matching
 - Extensible records and row polymorphism
 - Interfaces (typeclasses) for ad-hoc polymorphism
 - Clear, useful compiler error messages
 - Runs on the Erlang VM (BEAM)
 - Easy Erlang/OTP interoperability
 

Motivation
Par aims to make statically-typed functional programming accessible and practical. Par combines the familiarity of dynamic, imperative langauges with the safety and expressiveness of functional paradigms.


