How To Install c2hs on Debian 9

In this tutorial we learn how to install c2hs on Debian 9. c2hs is C->Haskell Interface Generator

Introduction

In this tutorial we learn how to install c2hs on Debian 9.

What is c2hs

c2hs is:

C->Haskell is an interface generator that simplifies the development of Haskell bindings to C libraries. The tool processes existing C header files that determine data layout and function signatures on the C side in conjunction with Haskell modules that specify Haskell-side type signatures and marshaling details. Hooks embedded in the Haskell code signal access to C structures and functions – they are expanded by the interfacing tool in dependence on information from the corresponding C header file.

Haskell 98 is “the” standard lazy functional programming language. More info plus the language definition is at http://www.haskell.org/.

This package contains the c2hs parser.

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

Install c2hs Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install c2hs

Install c2hs Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install c2hs

Install c2hs 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 Debian. Update apt database with aptitude using the following command.

sudo aptitude update

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

sudo aptitude -y install c2hs

How To Uninstall c2hs on Debian 9

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

sudo apt-get remove c2hs

Uninstall c2hs And Its Dependencies

To uninstall c2hs and its dependencies that are no longer needed by Debian 9, we can use the command below:

sudo apt-get -y autoremove c2hs

Remove c2hs Configurations and Data

To remove c2hs configuration and data from Debian 9 we can use the following command:

sudo apt-get -y purge c2hs

Remove c2hs configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge c2hs

Dependencies

c2hs have the following dependencies:

References

Summary

In this tutorial we learn how to install c2hs package on Debian 9 using different package management tools: apt, apt-get and aptitude.