Installing Haskell

49 views
Skip to first unread message

Cris Perdue

unread,
Jul 2, 2019, 2:34:25 PM7/2/19
to meta...@googlegroups.com
This is apropos of Mario's work developing MM0 and translating to it and from there to other formalisms.  I am reporting this in the hope it may be useful to others. My result is an installation of Haskell with its "stack" tool on a Mac laptop, but along the way I also tried to install onto the "jessie" release of Debian Linux.

Installing GHC (the Haskell compiler) and the "stack" tool using the official Haskell image on Docker Hub is looking like a success at this point. The image is large -- IIRC 200MB download and looks to be a bit over 1GB on disk, but functions well for me, and Docker makes it easy to discard at some future time if I wish.

I would suggest downloading with

$ docker pull haskell:8.6.3

as that image and its GHC matches the expectations of Mario's stack.yaml configuration, though you should be able to override that configuration with a command line option. I did have to increase the memory allowed to "Docker Engine" in the Docker Desktop preferences. 1GB RAM was not enough, and building Mario's mm0-hs failed with somewhat obscure messages that mentioned possible "out of memory".  4GB has worked fine so far. My old Macbook Air has 8GB physical RAM.

Along the way I tried installing onto a virtual server that I use as a web server, running the "jessie" distribution of Debian Linux. Given the modest resources of the server, this was an abject failure.  The procedure I followed was as described at https://docs.haskellstack.org/en/v1.0.2/install_and_upgrade/#debian, followed by

$ stack build mm0-hs

which ran for a couple of hours compiling many Haskell system modules, but was far short of completion. Newer Linux distros probably have much better support, i.e. requiring much less building from source code.

Mario, did you set up the Haskell system you used? If so, perhaps you have some advice.

If anyone else wants to set up Haskell, especially on Mac, I am glad to help. There is a little more to know about using Docker effectively, which I am not trying to document right now.

Regards,
Cris

Mario Carneiro

unread,
Jul 2, 2019, 4:01:32 PM7/2/19
to metamath
Stack does tend to take up a significant amount of disk space, because it basically puts a complete installation of GHC in every project. There are flags you can use to use the global installation instead, but they go against Stack's goal of "reproducible builds".

I haven't attempted to be particularly careful to avoid importing too many dependencies, but an hour sounds about right for downloading and building all of them. On a dev machine usually that's a one time thing.

If this is a serious issue, I can try to set up travis to build binary releases so that you don't have to compile it yourself. The Haskell build environment is not very small, but the resulting executables are pretty fast and don't require that whole infrastructure.

I don't know much about docker, but perhaps something at https://docs.haskellstack.org/en/stable/docker_integration/ is helpful. If there is something I need to change with my stack.yaml to make it work properly, feel free to send me a PR. I just call "stack" on my machine; I'm not really clear on what the point of running the build in a docker container is since stack is already going to pains to keep the build environment stable.


--
You received this message because you are subscribed to the Google Groups "Metamath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to metamath+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/CAOoe%3DWLyMqQjFa%2BXnJdFD_SC75HfGoWfJ7TiLxo-_-xXRc0_ng%40mail.gmail.com.

Giovanni Mascellani

unread,
Jul 2, 2019, 4:30:52 PM7/2/19
to meta...@googlegroups.com
Hi,

Il 02/07/19 20:34, Cris Perdue ha scritto:
> Installing GHC (the Haskell compiler) and the "stack" tool using the
> official Haskell image on Docker Hub is looking like a success at this
> point. The image is large -- IIRC 200MB download and looks to be a bit
> over 1GB on disk, but functions well for me, and Docker makes it easy to
> discard at some future time if I wish.

Unless I misremember, all I had to do on a Debian system to run Mario's
program was to install the package haskell-stack and then execute the
stack command as documented by Mario. No need to deal with docker.

Giovanni.
--
Giovanni Mascellani <g.masc...@gmail.com>
Postdoc researcher - Université Libre de Bruxelles

Cris Perdue

unread,
Jul 2, 2019, 6:17:01 PM7/2/19
to meta...@googlegroups.com
Giovanni,

That is good to hear.

To be clear though, I am not suggesting Docker on a Linux machine, but on a Mac. There are probably other good options, but Docker at least seems to be pretty viable.

I'm guessing your Debian release is newer than mine ("jessie").  The haskell-stack package is not part of jessie, but seems to be part of "stretch" and later releases. I'm glad that worked well for you.

-Cris

--
You received this message because you are subscribed to the Google Groups "Metamath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to metamath+u...@googlegroups.com.

Cris Perdue

unread,
Jul 2, 2019, 8:08:15 PM7/2/19
to meta...@googlegroups.com
On Tue, Jul 2, 2019 at 1:01 PM Mario Carneiro <di....@gmail.com> wrote:
Stack does tend to take up a significant amount of disk space, because it basically puts a complete installation of GHC in every project. There are flags you can use to use the global installation instead, but they go against Stack's goal of "reproducible builds".

I haven't attempted to be particularly careful to avoid importing too many dependencies, but an hour sounds about right for downloading and building all of them. On a dev machine usually that's a one time thing.

If this is a serious issue, I can try to set up travis to build binary releases so that you don't have to compile it yourself. The Haskell build environment is not very small, but the resulting executables are pretty fast and don't require that whole infrastructure.

I don't know much about docker, but perhaps something at https://docs.haskellstack.org/en/stable/docker_integration/ is helpful. If there is something I need to change with my stack.yaml to make it work properly, feel free to send me a PR. I just call "stack" on my machine; I'm not really clear on what the point of running the build in a docker container is since stack is already going to pains to keep the build environment stable.

think your stack.yaml is fine. Thanks for the offer though.

The point of building in a Docker container is that the container already has GHC and "stack" in it, and you can download the whole container with a  quick one-liner. The Docker image is pretty complete, I think, so I didn't have to do much after downloading it. Is there some other, comparably easy way to install Haskell on Macs? I don't know.

The documentation URL you show above related to "docker_integration" is in some sense an opposite way to use Docker with Haskell. They seem to assume that you set up "stack" on the Mac and have it interface with Docker for you. I couldn't think of any reason to be interested in that approach.



On Tue, Jul 2, 2019 at 2:34 PM Cris Perdue <cr...@perdues.com> wrote:
This is apropos of Mario's work developing MM0 and translating to it and from there to other formalisms.  I am reporting this in the hope it may be useful to others. My result is an installation of Haskell with its "stack" tool on a Mac laptop, but along the way I also tried to install onto the "jessie" release of Debian Linux.

Installing GHC (the Haskell compiler) and the "stack" tool using the official Haskell image on Docker Hub is looking like a success at this point. The image is large -- IIRC 200MB download and looks to be a bit over 1GB on disk, but functions well for me, and Docker makes it easy to discard at some future time if I wish.

I would suggest downloading with

$ docker pull haskell:8.6.3

as that image and its GHC matches the expectations of Mario's stack.yaml configuration, though you should be able to override that configuration with a command line option. I did have to increase the memory allowed to "Docker Engine" in the Docker Desktop preferences. 1GB RAM was not enough, and building Mario's mm0-hs failed with somewhat obscure messages that mentioned possible "out of memory".  4GB has worked fine so far. My old Macbook Air has 8GB physical RAM.

Along the way I tried installing onto a virtual server that I use as a web server, running the "jessie" distribution of Debian Linux. Given the modest resources of the server, this was an abject failure.  The procedure I followed was as described at https://docs.haskellstack.org/en/v1.0.2/install_and_upgrade/#debian, followed by

$ stack build mm0-hs

which ran for a couple of hours compiling many Haskell system modules, but was far short of completion. Newer Linux distros probably have much better support, i.e. requiring much less building from source code.

Mario, did you set up the Haskell system you used? If so, perhaps you have some advice.

If anyone else wants to set up Haskell, especially on Mac, I am glad to help. There is a little more to know about using Docker effectively, which I am not trying to document right now.

Regards,
Cris

--
You received this message because you are subscribed to the Google Groups "Metamath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to metamath+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/CAOoe%3DWLyMqQjFa%2BXnJdFD_SC75HfGoWfJ7TiLxo-_-xXRc0_ng%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Metamath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to metamath+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages