Hello World in Koka

Published on 09 November 2018 (Updated: 02 May 2020)

Hello World in Koka

In this article, we’ll learn how to implement Hello World in Koka.

How to Implement the Solution

Now, let’s see how we can print a simple “Hello World” in Koka:

function main()
  println("Hello, World!")

Just like many other programming languages, the main function is the starting point of the code execution. To print, we use println, a built-in method that prints a given string or variable to the console.

Like many of the high-level language implementations in this series, this one wasn’t too bad. Wanna try it out? Check out this online Koka editor.

How to Run the Solution

If you want to run Koka at your local machine, you can always install the Koka compiler and try the snippet locally. There are no binary releases of Koka though. You will have to build the compiler yourself. Don’t worry! It sounds harder than it is. All you need to do is install the following programs:

Now, you need to clone the Koka repository to your local environment. Then, run the following commands at the local repo directory:

npm install
cabal update
cabal install alex

jake is the command for building the compiler, and it also runs the Koka interactive environment where you can play around with Koka.

To actually run the solution, you need to run the following commands:


There you go! The sky is the limit now. But if you need help, you can check out the Koka book and the documentation.

Further Reading