· haskell

Haskell: Downloading the core library source code

I’ve started playing around with Haskell again and since I’m doing so on a new machine I don’t have a copy of the language source code.

I wanted to rectify that situation but my Google fu was weak and it took me way too long to figure out how to get it so I thought I’d better document it for future me.

The easiest way is to clone the copy of the GHC repository on github: ~text git clone https://github.com/ghc/ghc.git ~

Initially that doesn’t have any of the code for the core libraries but running the following command (which takes ages!) sorts it out: ~text cd ghc ./sync-all get ~

Noticing that the core libraries weren’t there initially I thought I must have done something wrong so I went to the documentation for the function that I wanted to see the source for - http://hackage.haskell.org/packages/archive/array/0.2.0.0/doc/html/Data-Array-MArray.html#v%3AgetAssocs.

From that page there is a link to the source for that function and a bit tweaking of the URL lets us know that this function is defined in the array package.

Most of the base packages are available from the Haskell darcs repository so I ended up cloning the ones I wanted in the time that it took for the sync-all script to run. ~text darcs get http://darcs.haskell.org/packages/base/ # gets most of the packages we’d be interested in darcs get http://darcs.haskell.org/packages/array/ # gets the array package ~

Of course I could have just been patient and waited for the script to finish...

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket