Tem Pora
Tem Pora

Reputation: 2093

Haskell linux install a module without cabal

I have developed a module (M.hs) which depends upon 3 other modules (A.hs, B.hs and C.hs). Now I want to use the module M across multiple other projects. So I have to install this module. But for learning purpose I don't want to use cabal, I want to do it manually. I want to install it in my home dir.

What is a proper course of action? Which files to be created, copied? where? How to use this module in other project?

Additional info:

  1. I am using Debian 6
  2. I am using GHC 6.12

Upvotes: 1

Views: 347

Answers (1)

Joachim Breitner
Joachim Breitner

Reputation: 25763

You say you don’t want to use cabal, but would you use Cabal?

cabal is the name of the command line tool provided by cabal-install which can download packages from Hackage and resolve dependencies.

Cabal is the library that Haskell code uses to drive the compilation (e.g. pre-process files, build in the right order, build variants, generate documentation) and install into the right location.

I would not recommend not using Cabal, even for learning purposes, until you want to write a replacement for it. But if you really want to do it, here is the rough outline, with enough details to figure out for a good learning experience:

  1. Build your files with -package-name yourpkgname-version.
  2. Link the generated files to form a libyourpkgname-version.a file.
  3. Create a package configuration file like /var/lib/ghc/package.conf.d/mtl-2.1.2.conf, and pay attention to name, `exposed-modules, import-dirs, library-dirs and hs-libraries
  4. Register package by passing it to ghc-pkg register

Upvotes: 2

Related Questions