How To Install cpphs on Ubuntu 22.04

In this tutorial we learn how to install cpphs on Ubuntu 22.04. cpphs is Simplified cpp-a-like preprocessor for Haskell

Introduction

In this tutorial we learn how to install cpphs on Ubuntu 22.04.

What is cpphs

cpphs is:

The C pre-processor has been widely used in Haskell source code. It enables conditional compilation for different compilers, different versions of the same compiler, and different OS platforms. It is also occasionally used for its macro language, which can enable certain forms of platform-specific detail-filling, such as the tedious boilerplate generation of instance definitions and FFI declarations.

However, gcc’s cpp has recently been evolving to more strictly adhere to the C standard. This has had the effect of making it increasingly incompatible with Haskell’s syntax. This is a cpp-a-like designed with Haskell’s syntax in mind.

There are three methods to install cpphs on Ubuntu 22.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 cpphs Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install cpphs

Install cpphs Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install cpphs using apt by running the following command:

sudo apt -y install cpphs

Install cpphs 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 cpphs using aptitude by running the following command:

sudo aptitude -y install cpphs

How To Uninstall cpphs on Ubuntu 22.04

To uninstall only the cpphs package we can use the following command:

sudo apt-get remove cpphs

Uninstall cpphs And Its Dependencies

To uninstall cpphs and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove cpphs

Remove cpphs Configurations and Data

To remove cpphs configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge cpphs

Remove cpphs configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge cpphs

References

Summary

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