2
votes

Here's the scenario: I am working on project with the Parsec library on my OSX machine. I have the Haskell Platform installed, and have all necessary packages. Now, on my linux/CentOS server, I have ghc installed, but not the Haskell Platform, Cabal, or the necessary packages (in this case, Parsec). Because of say, user restrictions, I am unable to get these packages installed, however I have access to ghc. So my question becomes: Is there a way to "semi-compile" (terrible choice of words I'm sure) my project on the OSX machine so that it includes all the necessary Haskell code into a single .hs file (Specifically the imported packages)? Or an easy way to import/copy the packages I am using into my local file directory, so I can simply upload and compile? Basically a way to just bundle-up the necessary files and packages into a standalone source ready for compilation. I am still very new to Haskell so excuse me if this is a trivial task.

2

2 Answers

2
votes

Your best bet will likely be to do a local install of the Haskell Platform somewhere in your home directory. Since HP versions are tied to particular GHC versions, this means you'll likely need your own install of GHC as well.

Here's a great step-by-step guide for how to do this. You can get the required GHC binary tarballs here.

Once you've got that in place, you can use Cabal to install any other packages you need.

1
votes

Get cabal source from here. You can build and install it to your user home directory. Then put it on your PATH and use it to install the required dependencies in your user home directory. Then you can compile your code.

Note that you can install cabal and the dependencies to any directory you have access to using the --prefix option.