Monday, November 05, 2007

Compiling GHC on Scientific Linux V5

For a long time I wanted to go 'strictly functional' and what better way then to start with the beast, ghc. So about a couple of months back, I downloaded version 6.6.1 [ ] and started reading YAHT [ ]. Then the 'laziness' took over and my 'idea of being strictly functional' took a back-seat. The news of release of ghc Version 6.8.1 (3 November 2007) reignited the desire. This time I thought of compiling the ghc from source [ Main - , Extra Libs - ]. Make sure you have 4-5 hours and 1-1.5 GB of disc space! Become 'root' and extract the above two files: tar xvjf ghc-6.8.1-src.tar.bz2 tar xvjf ghc-6.8.1-src-extralibs.tar.bz2 Both of them will extract in the directory ./ghc-6.8.1. For compiling there are some dependencies to be taken care of: 1. ghc [I already had v 6.6.1, ] , it is interesting as the compilers compiles its next version [ ]: rpm -ivhf ghc661-6.6.1-2.el5.i386.rpm 2. cabal, Common Architecture for Building Applications and Libraries, which can be downloaded from and installation instructions need to be followed [ ]: tar xzf cabal- cd cabal-1.2.2 runhaskell Setup.hs configure runhaskell Setup.hs build runhaskell Setup.hs install 3. readline-devel, readline library which in turn has terminfo as dependence, so better to use yum for installation: yum install readline-devel 4. alex, A lexical analyser generator for Haskell, whose rpm can be downloaded from and installed easily: rpm -ivhf alex-2.1.0-1.i386.rpm 5. happy, the yacc of haskell [I read on to compile happy you need old version of happy]. But for me simply getting the source and installation worked fine: tar xvzf happy-1.17-html.tar.gz cd happy-1.17 runhaskell Setup.hs configure runhaskell Setup.hs build runhaskell Setup.hs install We are all set for the ghc compilation: cd ghc-6.8.1 ./configure make make install Clean up ~300MB from the older ghc (v 6.6.1) installation, I went the brute force way: make a "list" using 'find /usr -name ghc-6.6.1' and clean 'rm -rf "list"' Now I have to dig deeper into the release note ( ), one thing which has really got me interested is the introduction of debugger to GHCi. --------------------------"The Answer Lies in the Genome"--------------------------
clipped from

Haskell is a general purpose, purely functional programming language featuring static typing, higher order functions, polymorphism, type classes, and monadic effects. Haskell compilers are freely available for almost any computer.

blog it