Pirates of the JVM Series

Functional programming made easy: Here comes Eta

JAX Editorial Team

We’re making an unexpected stop today while sailing the Functional Sea. All haul ashore for some liberty on Eta Island! We talked to Rahul Muttineni, CTO at TypeLead and the creator of the Eta programming language about its advantages and disadvantages, its core principles, and more.

It’s been quite an adventure thus far on our Pirates of the JVM Series. First, a tour around the Functional Ocean, then a stop or two in the Dynamic Sea, and even a side trip to the Java Archipelago. Today, we’re sailing back to the Functional Sea for some liberty on Eta Island. Get ready for warm white sands, blue waves, and fruity alcoholic beverages inside of a coconut while we all learn to do the hula.

Click the image to see the whole Pirates of the JVM infographic.

Eta – Background Information

JAXenter: What was your motivation for working with Eta? What does Eta have to offer that other languages fail to provide?

Rahul Muttineni: I loved exploring new programming languages since I was a kid and 5 years ago I discovered Haskell and it just blew me away. I knew that language (or some variant of it) would be the future of programming because I knew the pain of building large, rapidly evolving systems – I had worked on an online multiplayer game at the age of 14 and had to add new features constantly. Recently, I was working as a Clojure consultant during which I learned the importance of the Java platform and learned that the current JVM languages don’t offer the same benefits that I was used to in Haskell. So I set off to figure out how to get Haskell to work on the JVM and evolve the language in new directions that are more friendly to mainstream programmers. Eta was born as a result of that effort.

Eta is a pure functional language on the JVM that offers you more sanity during software development. You can reason about you code better and know what’s going on. It’s easier for people to see the core business logic without getting bogged down in the details. The compiler will prevent you from making stupid mistakes (much more so than other statically-typed languages!). We’re human and no matter how much expertise we gain in programming, on a bad day, we make mistakes and those mistakes can be costly. Moreover, it’s easier to teach to everyone because it follows naturally from mathematics where you don’t have variables that change values over time – the aspect of imperative languages that was found to make programming hard for some people.

Eta… offers you more sanity during software development.

Scala and Clojure, the two other major functional languages on the JVM, only offer part of the benefits mentioned above. Clojure has immutability by default making it easy to reason about code, but is dynamically typed meaning that there are no static checks (= mistakes on bad days). Scala, on the other hand, has a powerful type system and tries to mix both functional and OOP paradigms in one language (which restricts the power of the type system), and it not immutable by default as you have to specify it for every variable declaration. Eta has the benefits from both languages and more! Both of these languages were influenced by Haskell, and continue to support more ideas from it. So, we understood that to make programming languages on the JVM better, we needed to go the source: Haskell.

JAXenter: Can you describe the core principles of the language?

Rahul Muttineni: Check out our website here. It concisely explains the core principles with examples.

JAXenter: What would a typical program with Eta look like?

Rahul Muttineni: There are many code samples in the docs, you can pick one of them.

JAXenter: For what kind of applications/use cases is Eta well-suited?  – for which ones it is not?

Rahul Muttineni: Eta is a general-purpose language so you can build anything with it. But having said that, its core principles make it easy for beginners to program highly concurrent/parallel systems with ease and without shooting themselves in the foot. Moreover, Eta’s powerful type system gives you a layer of testing at compile-time that can reduce the number of tests you need to maintain because the compiler will do a bunch of static checks every time you compile. This means rapidly evolving applications can add new features without breaking existing ones because the best software engineering practices are enforced at the language level.

Because Eta is immutable by default and lazy (storing suspended expressions), it can generate a large amount of garbage, putting pressure on the garbage collector. This means for applications where raw performance really matters, Eta probably wouldn’t be a good choice. But that is not to say you can’t tune Eta for low-latency applications by tweaking the GC settings appropriately and using the rewrite rules feature to tell the compiler to optimize your code more aggressively!

In short, for large applications that need to be stable in the long term and change frequently or make use of concurrency/parallelism, Eta is perfect. For applications that require bare-metal performance, Eta wouldn’t be a good fit.

JAXenter: What is the current state of the language?

Rahul Muttineni: The language is in the alpha stage, but the compiler and runtime system themselves are pretty stable. The tooling and libraries are still a bit immature, but we are rapidly growing.  We’ve made the integration with Java very nice so that you can easily write bindings to libraries like JavaFX, JDBC, Apache Spark, etc. Moreover, we have kept compatibility with the Haskell language enough where we even have access to a large number of Haskell libraries as well!

You can find some examples here, here, and here from our Github page.


This example is particularly interesting because it uses a concept called Functional Reactive Programming and the library that implements that is from Haskell, yet Eta can compile it! Moreover, it also binds to the JavaFX Canvas API to draw the game graphics, clearly demonstrating that accessing both the Haskell and Java ecosystems from Eta is straightforward.

JAXenter: How about your plans?

Rahul Muttineni: The aspects we’ll be focusing on going forward are described on our GitHub page:

  • Concurrent runtime
  • Interactive REPL
  • Metaprogramming (TemplateHaskell support)
  • Core library support
  • Boilerplate generation for Java FFI imports
  • Platform-specific installers

We have built a company around this called TypeLead, so we do provide commercial support and training for companies who would like to use Eta in production. You can find the vision of the company here.

JAXenter: How can people interested in Eta get started?

Rahul Muttineni: If people are interested in Eta, they should head on over to our Getting Started page. It’s full of helpful resources for beginners.

JAXenter: Thanks for the interview!

Rahul Muttineni: Thanks for having me.

Rahul Muttineni is the co-founder of TypeLead and author of the Eta programming language. He’s been actively exploring better ways of programming since childhood. Rahul has worked on online multiplayer games, augmented reality, real-time applications, and many more. He is passionate about bringing the wonders of purely functional programming to the mainstream developer community.


Pirates of the JVM — The series:



Don’t forget to check out the Pirates of the JVM series.

Leave a Reply

Be the First to Comment!

Notify of