Haskell at the user level

I like coding in Haskell, but often I am on a computer where I can’t install the software, and which has some limitations on what you can run. I would like to write Haskell code and test it on this computer. Does anyone know a version of Haskell, interpreted or compiled, written in Java, JavaScript, Ruby, Python, or another interpreted language, available when installed by default on a Mac? A standalone version of Haskell is also available, which can be installed at the user level, but compiling Haskell alone is not an option.

+4
source share
3 answers

GHC binary distributions (those that ship as tarballs, not installers) can be easily installed easily trivially.

./configure --prefix=$HOME/ghc make install 

Then update your path to include $ HOME / ghc / bin

If you want to use cabal, get tarball from hackage , then unlock it and run bootstrap.sh.

GHC works very well, like a local installation. In fact, I never use it as a system installation.

+11
source

I also do this on my workstation, so the distribution I work for (Debian in my case) does not suddenly start updating without my comment in a simple apt-get upgrade .

This solution installs the full ghc and haskell-platform , as well as the ~/.cabal .

First of all, I have a ~/local directory that I use to put compiled programs in my home directory. I usually don't like the sudo make install step because I give some random Makefile root access to my system, and it makes me feel nauseous.

Then I download the ghc binary distribution from the ghc site . Please note that I linked you to 7.4.2. I heard that there are some segfault errors on Mac OS X, but I don’t know the details. You should check this out or get a newer ghc , but keep in mind that there are many hack packages that are not yet installed to work with 7.6. Also ignore that "STOP!" warning, you are 1% who really want a non-distribution GHC binary.

You can simply write cd to the ghc directory, then do ./configure --prefix=$HOME/local/haskell or so, then make install (without compilation, it just builds, not compiles.)

At this point, you should add ~/local/haskell/bin to your path. Here is the code I put in my ~/.zshrc that will add all the ~/local/*/bin to your path.

Then you can get the Haskell platform and do the same dance ./configure --prefix=$HOME/local/haskell && make && make install . This step will require compilation. This means that you will need some header libraries. I find random openGL headers that are especially annoying.

You can also skip the haskell platform and just download cabal-install and then install what you need. In any case, you must remember to add ~/.cabal/bin to your $PATH !

Do a cabal update , and you should be fine.

NOTE. There is one important part that the binary GHC distribution requires, which can sometimes be light on older Linux systems: libgmp. It is dynamically linked to it, and if you get some errors that the common libgmp is not found in OS X, you can too ... well, ask this question in a comment and I will explain how to get there. Basically, you will have to compile libgmp + deps.

But I do not think that this should be a problem for OS X. This is just a problem in a couple of old debian mailboxes in which I tried this.

+3
source

For individual files you can use codepad .

+2
source

Source: https://habr.com/ru/post/1433047/


All Articles