How To Install ghc-mod on Ubuntu 18.04

In this tutorial we learn how to install ghc-mod on Ubuntu 18.04. ghc-mod is Happy Haskell programming

Introduction

In this tutorial we learn how to install ghc-mod on Ubuntu 18.04.

What is ghc-mod

ghc-mod is:

This package provides the executables ghc-mod and ghc-modi. The GNU Emacs integration code is provided by a separate package, namely ghc-mod-el.

There are three methods to install ghc-mod on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install ghc-mod Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install ghc-mod using apt-get by running the following command:

sudo apt-get -y install ghc-mod

Install ghc-mod Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install ghc-mod using apt by running the following command:

sudo apt -y install ghc-mod

Install ghc-mod Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install ghc-mod using aptitude by running the following command:

sudo aptitude -y install ghc-mod

How To Uninstall ghc-mod on Ubuntu 18.04

To uninstall only the ghc-mod package we can use the following command:

sudo apt-get remove ghc-mod

Uninstall ghc-mod And Its Dependencies

To uninstall ghc-mod and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove ghc-mod

Remove ghc-mod Configurations and Data

To remove ghc-mod configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge ghc-mod

Remove ghc-mod configuration, data, and all of its dependencies

We can use the following command to remove ghc-mod configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge ghc-mod

References

Summary

In this tutorial we learn how to install ghc-mod package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.