Skip to content
ElaraLangPublic

About

Elara is a purely-functional programming language targeting the JVM

Topics

Resources

Contributing

Stars

18 stars

Watchers

4 watching

Forks

Latest commit

 

History

1,483 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elara

A Haskell-like purely functional language for the JVM

CI Docs License: MIT Discord

Documentation · Compiler API reference · Examples · Discord

Warning

Elara is currently a work in progress, expect a lot of breaking changes and unfinished features!

A Brief Example

import Elara.Prim


type Option a = None | Some a

def map : (a -> b) -> Option a -> Option b
let map f opt =
    match opt with
        None -> None
        Some x -> Some (f x)

def main : IO ()
let main = println (map (\x -> x * 2) (Some 3))

-- Prints: Some 6

Why Elara?

Elara was made to try and achieve two things. If you like the sound of these, Elara could be for you:

  • A Haskell-like language on the JVM platform with high quality interoperability (todo)
  • A modern Elm and Rust-like developer experience

In general, Elara also has some pretty cool features:

  • Haskell- and F#-style, on the JVM. Algebraic data types, pattern matching and inferred Hindley-Milner polymorphism, compiled to JVM bytecode.
  • High Quality Rust- and Elm-Style Error Messages:

    Elara type error: Int is not compatible with String, with the offending expression underlined

  • Modern Compiler Architecture: A query-based compiler with constraint-based Hindley-Milner inference.
Comparison with other languages
Elara Haskell Frege Eta Scala 3 Elm Gleam
Runs on the JVM ✅ ❌ ✅ ✅ ✅ ❌ ❌
Effects tracked in types ✅ ✅ ✅ ✅ ❌ ✅ ❌
Full type inference ✅ ✅ ✅ ✅ ⚠️ partly ✅ ✅
Type classes / traits ⚠️ planned ✅ ✅ ✅ ✅ ❌ ❌
Actively maintained ✅ ✅ ⚠️ quiet ❌ ✅ ⚠️ slow ✅
Production-ready ❌ ✅ ⚠️ ⚠️ ✅ ✅ ✅

✅ yes · ⚠️ partly · ❌ no

Quick Start

1. Get Elara

# prebuilt statically-linked binary for x86-64 Linux, see the Releases page for others
curl -fsSL https://github.com/ElaraLang/elara/releases/download/dev-build/elara-x86_64-linux -o elara
chmod +x elara

or build from source with Nix: nix develop, then just run hello.elr builds and runs it in one command. You'll also need a JDK if using the JVM backend.

For detailed build instructions see the documentation

2. Write a program

-- hello.elr
import Prelude
import Elara.Prim

def main : IO ()
let main = println "Hello, World!"

3. Run it

./elara run hello.elr                 # run in the interpreter
./elara run hello.elr --target jvm    # compile to JVM bytecode and run on the JVM

More runnable programs are in examples/, demonstrating features like pattern matching, higher-order functions, polymorphism, a JSON parser, and more.

Status

Elara is still in early stages. So far, we have a full working pipeline (parse → rename → typecheck → Core → JVM / Interpreter), a small standard library, and a golden-tested set of examples and error messages. See the changelog for what's changed recently.

Contributing

Contributions are always very welcome! Start with CONTRIBUTING.md and the development setup, then look for issues labelled good first issue. If you have questions, ask on Discord.

Library Acknowledgments

Elara owes its existence to numerous open-source projects, particularly to Grace for its use as a reference implementation for type checking.

License

Elara is released under the MIT License.

About

Elara is a purely-functional programming language targeting the JVM

Topics

Resources

Contributing

Stars

18 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages