purescript icon indicating copy to clipboard operation
purescript copied to clipboard

Exercise dependencies

Open emiel opened this issue 4 years ago • 5 comments

I've put in some work into the switch over to Spago. One thing that has me thinking is how to deal with exercise dependencies (spago.dhall).

  • We have the example solution which make use of certain dependencies. These are not necessarily the dependencies the student needs to use to solve the exercise. I'm thinking we could decouple these by having a spago.dhall file, i.e. solution.dhall to use for building and testing under CI.
  • Do we give the student a common set of dependencies so they do not need to worry about installing anything. Or do we give them the absolute basics and make them install anything they use? PureScript 0.14.x will start warning about unused dependencies and this can be a bit annoying.

Your thoughts?

emiel avatar May 09 '21 13:05 emiel

If this is expected behaviour when writing PureScript, having the student install would be an okay approach, but don't forget that we can't facilitate that (currently) when using the Web interface. Having a common set of dependencies, or the "correct" set per exercise might be the way to go.

SleeplessByte avatar May 09 '21 16:05 SleeplessByte

Thanks for the feedback @SleeplessByte. I had not considered the new web interface. I'll poke around and see how https://try.purescript.org handles this situation.

emiel avatar May 10 '21 08:05 emiel

As @SleeplessByte alluded to, the PureScript test runner runs without networking, which means that it can't install any additional dependencies when trying to run the tests. Tracks workaround this by pre-installing dependencies within the Dockerfile (which does have access to networking), which means that they won't have to be retrieved from the internet once the tests run. Applying this to your question, you can either:

  1. Install a huge number of libraries in the Dockerfile
  2. Pre-define the libraries to use in the exercises

I think 2 is the more safer approach.

ErikSchierboom avatar May 11 '21 09:05 ErikSchierboom

Anything outstanding here?

icyrockcom avatar Aug 15 '21 20:08 icyrockcom

Hi, I bumped into the issue with dependencies while solving some of the exercises. I have done them locally to my likings but then I could not find a way how to submit my extra dependecies back to exercism (see #235 for more details).

I guess that ErikSchierboom's option 2 would be a good way to solve these problems quite easily as there are currently not that many exercises in the track (of course this might take its toll while adding new exercises later). Maybe with broader choice in case of more reasonable solutions. I am happy to help with that but my knowledge of Purescript is very limited so far. That is I am not in position to actually choose all the recommended libraries. But I guess it should be safe to include at least some more common data structures, broader string utilities and so on (eg. unordered-collections, strings-extra, parsing, ...). Maybe we can come up with some list of recommendations together?

In any case is there anything I can help with here?

tomasurbanec avatar Aug 24 '22 13:08 tomasurbanec