Integrating Haskell with ATOM Editor on Ubuntu

I am a cryptocurrency investor, developer, miner and bitcoin professional certified by C4. Among several researches and enthusiasm on crypto world, there is a project that is my favorite. The name of this project is Cardano and brings a cryptocurrency called ADA. Cardano is a project involving several scientists, professors of renowned universities and system architects that created over 40 high quality white-papers describing the network synergy. Cardano and its products are being developed by a company called IOHK in collaboration with open source community and other third-party companies.  According the founder and CEO of IOHK, Charles Hoskinson, Cardano is classified as a cryptocurrency generation 3, based on PoS (Proof of Stake), smart-contracts with a decentralized network but much more scalable and sustainable when compared to old generations like Bitcoin and Ethereum.

Most part of the code is based on Haskell which is a functional language that works in a very different way when we compare with sequential and imperative languages like C, C++, Java, etc.

The idea of this post is to create a guide how to integrate Haskell with Atom editor on Ubuntu OS and help you to learn Haskell fast with a good IDE. The Ubuntu distro used on this post was version 19  but you also can use the procedure explained on this post in older versions as well.

More information about Cardano (ADA) please visit:

Before we start!

The procedure here will be using Stack tool set for Haskell. I literally was not able to make that work with GHC compiler superior to 8.0.2 due to several dependence of ghc-mod which is used as intermediary between the back-end (Stack) and or front-end (Atom). 

If you are already using Stack you can skip the step 1 going directly to step 2.

Step 1) Installing Haskell

Basically there are 3 ways you can install Haskell:

  1. Stack: this is the method we will use here. Stack is a package manager and build tool that creates a “sandbox” of Haskell and its respective tools isolating everything you have installed in your system. For example, if you have a Haskell compiler (GHC) installed in the system, when you install stack another compiler is installed in the sandbox and your compiler in the system is not “touched”. Optionally you can integrate with your compiler in the system but it is not what we will do here.
  2. Hashkell-Platform: this definetly it is the easiest way to install haskell on ubuntu (sudo apt-get install haskell-platform) but this also brings several problem when integrating the Atom that I will explain later. Basic when you install the platform, the compiler and other tools are installed in the system OS and not in a sandbox like Stack.
  3. Cabal: It is similar to stack but cabal also can be installed via stack and we will see in the next steps. You can install  cabal using stack

To install stack open a terminal and type:

[simterm theme=”ubuntu”]

##green##$sudo wget -qO- | sh

Stack has been installed to: /usr/local/bin/stack

WARNING: ‘/home/manny/.local/bin’ is not on your PATH.
For best results, please add it to the beginning of PATH in your profile.


After the installation it is recommended to add the path of stack in your profile. For example, if you are using bash, open the .bashrc file and include the path in the system path like below:

[simterm theme=”ubuntu”]

##green##$export PATH=$PATH:~/.local/bin


Check the version of the compiler installed:

[simterm theme=”ubuntu”]

##green##$stack ghc — –version
The Glorious Glasgow Haskell Compilation System, version 8.6.4


Step 2) Installing the ghc-mod properly

If you try to install the ghc-mod using Stack without any extra specification (i.e., stack install ghc-mod) you will realize there are several dependencies that must be resolved. You have two option on this case, the first one if to specify during the installation the lts compatible to ghc-mod. This will force to have all dependencies resolved.

[simterm theme=”ubuntu”]

##green##$stack install ghc-mod –resolver lts-8.24


The second way is to install the dependences one by one and change the stack.yaml in the ~/.stack/global-project/stack.yaml. Sorry guys, it is Saturday night and I am very lazy today, I will use the method above using the resolver.

Step 3) Installing Cabal via Stack

OK… super simple.. just type:

[simterm theme=”ubuntu”]

##green##$stack install cabal-install –resolver lts-8.24


Step 4) Testing your installation

If you achieve this step without problems, congrats!!! Your “back-end” is already installed and let’s test it creating a Hello World project. The cool thing is stack brings some templates that helps you during the creating of your project. We will use the template “simple” that brings a “Hello World” program.

[simterm theme=”ubuntu”]

##green##$ mkdir Cardano
##green##$ cd Cardano

##green##$ stack new myfirstproject simple
Downloading template “simple” to create project “myfirstproject” in myfirstproject/ …

The following parameters were needed by the template but not provided: author-name
You can provide them in /home/manny/.stack/config.yaml, like this:
author-name: value
Or you can pass each one as parameters like this:
stack new myfirstproject simple -p “author-name:value”

The following parameters were needed by the template but not provided: author-email, author-name, category, copyright, github-username
You can provide them in /home/manny/.stack/config.yaml, like this:
author-email: value
author-name: value
category: value
copyright: value
github-username: value
Or you can pass each one as parameters like this:
stack new myfirstproject simple -p “author-email:value” -p “author-name:value” -p “category:value” -p “copyright:value” -p “github-username:value”

Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
– myfirstproject/

Selecting the best among 15 snapshots…

* Matches lts-13.18

Selected resolver: lts-13.18
Initialising configuration using resolver: lts-13.18
##blue##Total number of user packages considered: 1
##blue##Writing configuration to file: myfirstproject/stack.yaml
##blue##All done.


check the source code:

[simterm theme=”ubuntu”]

##green##$ ls
##green##$ cd myfirstproject/
##green##$ ls
##blue##LICENSE myfirstproject.cabal Setup.hs src stack.yaml

##green##$ cat src/Main.hs
##green##module Main where

##blue##main :: IO ()
##blue##main = do
##blue##putStrLn “hello world”


Let’s run.. make sure you have the “setup” and then “build” it!

[simterm theme=”ubuntu”]

##green##$ stack setup
stack will use a sandboxed GHC it installed
For more information on paths, see ‘stack path’ and ‘stack exec env’
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec

##green##$ stack build
Building all executables for `myfirstproject’ once.

After a successful build of all of them, only specified executables will be rebuilt.
myfirstproject- configure (exe)
Configuring myfirstproject-…
myfirstproject- build (exe)
Preprocessing executable ‘myfirstproject’ for myfirstproject-
Building executable ‘myfirstproject’ for myfirstproject-
[1 of 1] Compiling Main ( src/Main.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal- )
Linking .stack-work/dist/x86_64-linux-tinfo6/Cabal- …
myfirstproject- copy/register
Installing executable myfirstproject in /home/manny/Cardano/myfirstproject/.stack-work/install/x86_64-linux-tinfo6/lts-13.18/8.6.4/bin


Finally run !!!!

[simterm theme=”ubuntu”]

##green##$ stack exec myfirstproject
hello world



Step 5) Installing Atom

Let’s install our “Front-End” that will use the ghc-mod to communicate with the stack.

If you already have Atom installed just jump to step 6.

In Ubuntu 19, you simply can type in your console

[simterm theme=”ubuntu”]

##green##$ sudo snap install atom –classic
> atom 1.36.0 from Snapcrafters installed


In case you do not have snap in your distro, you can install it symply typing:

sudo apt-get install snap

Step 6) Installing Atom plugins

There are two ways to install the plug-ins.. via UI or via command line using the apm (Atom Package Manager). I will do it in the fast way.. just type:

[simterm theme=”ubuntu”]

##green##sudo apm install language-haskell ide-haskell ide-haskell-cabal haskell-ghc-mod autocomplete-haskell



Step 7) Testing Atom with Haskell IDE (Finally……)

Let’s run the editor.. in your console type “atom”

[simterm theme=”ubuntu”]

##green## $atom


In the editor, open the Main.hs file generated when we created the project. To do this, press “ALT” key to see the menu and File –> Open File and locate the Main.hs we created before.

If you pressed the “ALT” key and do not see the menu, you are probably is using Ubuntu 18 or 19. There is a trick to fix this issue (not an Atom issue indeed), on this case see the last section “Troubleshoot”.

After you open the Main.hs, clique on ALT key again and select

Haskell IDE -> Builder -> Set Active Builder

Select “Stack” as your default option.

Now you are ready to build… Again after the ALT select:

Haskell IDE -> Builder -> Build Project

You should see your project compiled without problem as below:

click on me!


Now you have the IDE ready to your Haskell code!!! Explore the auto-completiton, the syntax highlight, and several other options. For more details visit this link:


If you are not seeing the menu after press the key “ALT” you probably is using Ubuntu 18.04 or 19. There is a problem on this distro not Atom, but this is easily resolved changed the theme. For this install and run the following:

[simterm theme=”ubuntu”]

##green## $sudo apt install gnome-tweak-tool

gnome-tweak installed.

##green## $gnome-tweaks


Change the application theme appearance from “Yaru” to “Yaru-Dark“. The problem will be resolved.

Did this post helped you ?

You can buy me a coffee in ADA. Please use the address below:

[crypto-donation-box type=”tabular”]


1 thought on “Integrating Haskell with ATOM Editor on Ubuntu

Leave a Reply