Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haskell stack needs 2.5gb of space #1043

Closed
bmacho opened this issue Dec 22, 2021 · 8 comments
Closed

Haskell stack needs 2.5gb of space #1043

bmacho opened this issue Dec 22, 2021 · 8 comments

Comments

@bmacho
Copy link

bmacho commented Dec 22, 2021

Also it needs 5 gb of free space for installation.

I can't test my solutions without it. That's a bit extreme space requirement, just for checking if two values are equal.

Wouldn't it be possible and desirable to test only with ghc/ghci, without the need of the whole stack?

@github-actions
Copy link

Hi and welcome to Exercism! 👋

Thanks for opening an issue 🙂

  • If you are suggesting a new feature or an improvement to Exercism, please take a read of this post, which will likely result in a faster response.
  • If you are reporting a bug in the website, thank you! We are getting a lot of reports at the moment (which is great), but we triage and reply as soon as we can.
  • If you are requesting support, someone will help shortly.
  • For everything else, we will reply or triage your issue to the right repository soon.

@SleeplessByte
Copy link
Member

cc @exercism/haskell

@bmacho
Copy link
Author

bmacho commented Dec 22, 2021

Okay, with some random things I was able to test the hello world example, with 80MB of the stack binary, and 40MB of .stack folder. I don't know exactly what caused it ( I random copied things from https://wiki.archlinux.org/title/Haskell#Configuring_Stack_for_dynamic_linking ) but maybe this will do:

  • get the stack binary, and don't start it yet
  • paste
# Stop downloading GHCs into isolated locations under ~/.stack.
install-ghc: false

# Allow Stack to pick the system GHC (false by default).
system-ghc: true

# Add the -dynamic flag to every invocation of GHC.
ghc-options:
  "$everything": -dynamic

into ~/.stack/config.yaml

check your GHC version, and find a suitable resolver version here https://www.stackage.org/
E.g. for my ghc 8.6.5, lts-14.27 was it.

Modify the stack.yaml file in the exercise folder, to match your version, in my case, I changed resolver: lts-18.14 to resolver: lts-14.27.
That's it, if you run stack test, it will still download and compile some necessary packages (e.g. I don't think I had Test.Hspec installed previously), but only them. In my case it needed 40MB instead of 5 GB of space.

@petertseng
Copy link
Member

I usually run runghc -Wall -isrc test/Tests.hs since I don't have Stack installed. But I had not put that command in the documentation because... actually, I don't remember why. If there were some guidance that said "Your language track should only endorse one way of doing things because presenting more choices would just be more confusing" then I guess that would preclude adding it, but I don't recall that there is any guidance to that effect.

So that means here are my two suggestions, either or both of which can be tackled.

First, I'd like to find a good place to put the runghc -Wall -isrc test/Tests.hs command in, for those who don't want Stack or cannot install it for any reason. We would probably put it in https://github.com/exercism/haskell/blob/main/docs/TESTS.md. Perhaps https://github.com/exercism/haskell/blob/main/docs/INSTALLATION.md might also need to change, if we are going to present the alternative of not using Stack.

Second, if the directions presented to have Stack use system GHC are minimal and complete, they can be added. Will need to think about how to present them - is that something we're recommending to everyone, or is it just to those who want it? Will there be issues with students not being sure how to correctly follow the instructions, or whether they should even follow them at all? etc.

@bmacho
Copy link
Author

bmacho commented Dec 22, 2021

On my Ubuntu system, sudo apt intsall libghc-hspec-dev provides the needing dependencies, and runghc -Wall -isrc test/Tests.hs works. (With GHC also from the repository.)
At least on the hello world example, I am not sure how far can one go with this space-optimized approach.

@petertseng
Copy link
Member

By minimal, I do not mean that it uses as little space as possible, but that there are no extraneous steps that can be removed. By complete, I mean that no steps are missing. Following the steps is all that is needed to use system GHC.

From my understanding of the steps, they meet these requirements, so no further modification to those steps is needed.

I have opened #1036 and #1037 in the Haskell track repo.

@ErikSchierboom ErikSchierboom transferred this issue from exercism/exercism Feb 3, 2022
@ErikSchierboom
Copy link
Member

@petertseng I've moved this to the haskell repo. Feel free to close this if you feel this is handled by the above mentioned issues.

@petertseng
Copy link
Member

Yes, I confirm that the above two issues are the actions that should be taken in response to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants