Frege is a Haskell for the JVM that brings purely functional programming to the Java platform.
Frege solves the problem of accessing functional programming paradigms within the Java ecosystem. It compiles to Java bytecode and runs on the JVM, allowing developers to write purely functional code that interoperates seamlessly with existing Java libraries. The language features a strong static type system with global type inference and lazy evaluation, enabling the compiler to reason about code purity. Functions marked as pure are stateless and free of side effects, making them inherently threadsafe and eligible for optimizations like automatic caching, parallel execution, and common subexpression elimination. Impure operations are tracked through the type system via an IO type, ensuring that side effects propagate through the call chain and remain visible to callers.
Frege suits developers who want to leverage functional programming concepts while remaining within the Java ecosystem and reusing existing Java libraries. It works well for projects where code reliability and maintainability benefit from eliminating mutable state and side effects. The language is particularly valuable when you need to embed pure, threadsafe functions within larger Java applications, since Frege code compiles to regular Java classes with standard main methods that can be invoked from any JVM language. The approach of creating islands of purity within imperative code allows gradual adoption rather than requiring a complete rewrite of existing systems.
The project maintains an online REPL for experimentation and demonstrates active engagement with making functional programming accessible through expressive syntax, such as list comprehensions that read similarly to SQL queries. Development activity shows sustained effort in documentation and examples that bridge the gap between imperative and functional programming styles, with particular attention to explaining concepts like lazy evaluation and the benefits of avoiding mutable state to developers unfamiliar with functional paradigms.