What is Eta?
Eta is pure, lazy, statically-typed functional programming language on the Java Virtual Machine.
These three features put together provide a pleasing development experience:
We are all used to large codebases that everyone is afraid to touch. We feel that is unacceptable and that we need a language that encourages best practices by construction and notifies you as soon as you are headed down a painful road.
We found that Haskell solves the problem, but we realized upon research that if it is to reach the industry at large, we must have an implementation on the JVM. This opens us up to the extremely mature JVM tooling and allows Eta to be used in enterprise settings.
Eta is a fork of GHC, the Glasgow Haskell Compiler, which focuses on:
As Eta shares the 25-year-old compiler infrastructure of GHC, the developer has access to very powerful optimizations that allows her to write high-level functional code and get good performance at the same time.
With Eta, you get the best of Haskell (language) and the best of Java (platform) which allows you to re-use a large repository of existing libraries.
We will now take a look at the famous "Hello World" program to get a feel for Eta syntax.
1 2 | main :: IO ()
main = putStrLn "Hello World!"
|
You can read this in your head as:
main is a special binder that corresponds to the start of the program. The entrypoint of the program must have type IO () which can be thought of as an operation that can potentially interact with file system, network, the OS, or perform any side-effect whatsoever.