The Eta team is happy to announce a new version of Eta — v0.7.2.

If you haven’t installed before, you can now install Eta using your favorite installation method:

Gradle

Etlas (Cabal compatible build tool for Eta)

Source

Docker

Nix

Eta Installation Methods

If you have a previous version of Eta installed via Etlas, getting Eta v0.7.2 is as easy as the following etlas commands:

$ etlas update

$ etlas select latest

Syntax Improvements in Java Wrapper Type

The new syntax for the Java Wrapper Type is very simple compared to the previous syntax and much more pleasing to the eye.

New Syntax

data X = X @[class-name]

deriving Class

Previous Syntax

data {-# CLASS "[class-name]" #-} X =

X (Object# X)

deriving Class

where X is the Eta name used to refer to the corresponding Java class

Build Improvements

Gradle — You can build Eta projects with Gradle.

— You can build Eta projects with Gradle. Eta Compiler — Speed of building uberjars (fatjars) improved by 2x

— Speed of building uberjars (fatjars) improved by 2x Etlas — Uses Nix-like build system which simplifies the usability.

For external packages that you build with Etlas, Etlas will generate a hash of the inputs used to build the package and will stash the build artifacts into the Etlas Store which identifies build artifacts by their package name, package version, and hash. Then, one each unique build, it checks to see if a package with the required hash already exists in the Store, bypasses the build step, and just reuses the artifact from the Store.

This allows you to use multiple versions of a package and multiple variants of the same package compiled using different flags to be used across different projects on the same system without facing dependency hell. This also enables use cases like using a distributed binary artifact cache for use within companies to save on time spent building packages.

Type Error and Compiler Messages Improvements

We backported GHC 8’s error message styling which has the caret that points to the exact expression that caused the problem.

Eta error message styling

We also reduced some noise and made the compiling messages slightly more fun to watch.

Eta Compiler Messages

New Documentation

Eta Documentation

We’ve done a major restructuring to Eta documentation. The documentation consists of the following sections:

User Guides — Check out the core language, tools and structure of Eta

— Check out the core language, tools and structure of Eta Tutorials — Check out simple use cases and examples in Eta

— Check out simple use cases and examples in Eta Cheatsheets —A quick reference for Eta

—A quick reference for Eta FAQ — Answers to our most-popular questions

The docs are written in Markdown format and anyone can contribute by sending a PR that modifies this folder in the main Eta repository.

Runtime Improvements

1) Memory Manager v2

The Eta runtime has an interface to deal with off-heap memory called the Memory Manager which provides low-level language primitives for dealing with raw memory, or memory that is not subject to garbage collection. This is very useful for low-latency applications where you simply can’t afford the overhead of GC.

The previous version of the Memory Manager was plagued with several memory leaks and had various concurrency bugs that were hard to reproduce and debug. Part of the problem was that it was implemented using a highly convoluted locking system with high write contention.

After spending some time with Martin Thompson’s blog, the Memory Manager v2 was redesigned to be easy to debug and with “mechanical sympathy” in mind.

2) Trampoline Function

The Eta compiler does a great job compiling tail recursive and mutually tail recursive functions into efficient, tight loops. Unfortunately, dynamic tail calls (tail calls which are not statically known), especially those found in continuation-passing style parsers, can quickly blow the stack.

To ameliorate this problem, making sure to keep the fine balance between performance and stack safety, we decided to create a user-facing primitive that “activates” a dynamic, specialized trampoline on demand through the use of the trampoline function.

The beauty of this solution is that you just need to use a trampoline function every time you want to make an stack-unsafe expression stack-safe. There is a minor performance overhead when you activate the trampoline — it will enable a codepath that is guarded behind a condition flag that counts the number of tail calls that have been made so that it can periodically unwind the stack to avoid StackOverflowError s.

Because of how JIT compilation speculates on branches, this additional code path does not affect your code when you don’t use the trampoline function. Hence, you can always trade stack safety for performance if needed.

This function is not yet documented but there are a few patches on Eta Hackage that make use of it:

Overall Performance Improvements

There were several performance bugs in the older versions of Eta that were due to various reasons:

Code generator generating code that failed to JIT compile

Using inefficient data structures in the runtime system

Not paying attention to mechanical sympathy

One by one, we resolved them and now performance is looking pretty good: within 1.5–2x of both Scala and Haskell in quite a few benchmarks that were showing 10x-20x difference in earlier versions. We hope to do more detailed benchmarking and release the results in the future.

Note that we haven’t hit the performance floor yet! We have several optimizations left to implement that can close the gap even further, but the performance as it stands allows Eta be to very practical to use right now.

Work-in-progress

Eta Prelude — Nikita Tchayka is working on a beginner-friendly Prelude (the module imported by default to all Eta source files) taking inspiration from various prelude efforts in the Haskell community. You can check it out here.

— Nikita Tchayka is working on a beginner-friendly Prelude (the module imported by default to all Eta source files) taking inspiration from various prelude efforts in the Haskell community. You can check it out here. Direct Interop — Rahul Muttineni has sketched out a design for a simpler way to interact with Java code through direct foreign imports which allows you to omit a lot of the boilerplate that you currently have to write. It is planned for the near future.

— Rahul Muttineni has sketched out a design for a simpler way to interact with Java code through direct foreign imports which allows you to omit a lot of the boilerplate that you currently have to write. It is planned for the near future. Dhall — Javier Neira is working on making Gabriel Gonzalez’s Dhall language as the standard configuration language for Etlas. He has even compiled Dhall with Eta and it is working pretty well.

— Javier Neira is working on making Gabriel Gonzalez’s Dhall language as the standard configuration language for Etlas. He has even compiled Dhall with Eta and it is working pretty well. Etlas Package Index —Jyothsna Patnam is working on an API reference for all the libraries that are supported by Eta.

—Jyothsna Patnam is working on an API reference for all the libraries that are supported by Eta. IntelliJ plugin — Cary Robbins has been working on the IntelliJ support for Eta which has progressed pretty well. Amajor part of it is written in Eta.

— Cary Robbins has been working on the IntelliJ support for Eta which has progressed pretty well. Amajor part of it is written in Eta. Type Error Messages —Jyothsna Patnam is working on better type error messages that attempt to guess the real root of the problem and supply the user with smart suggestions on how to resolve the type errors.

—Jyothsna Patnam is working on better type error messages that attempt to guess the real root of the problem and supply the user with smart suggestions on how to resolve the type errors. Fibers — Alberto Gomez Corona is working on a new Fiber implementation that takes advantage of the new trampolining primitive provided by the runtime system.

Our current focus is to resolve the last set of bugs and get Eta production ready as soon as possible.

We thank all the contributors and the community members who helped us get here.

If you have any issues, please reach out to us!

Gitter / IRC / Slack / Google Group / GitHub / Twitter