haskell icon indicating copy to clipboard operation
haskell copied to clipboard

`robot-name` practice exercise: Consider adding `random` to dependencies, to avoid "Could not load module ‘System.Random’ / It is a member of the hidden package ‘random-1.1’."

Open petertseng opened this issue 3 years ago • 0 comments

If the student submits a solution using System.Random but not package.yaml, the error would be:

Could not load module ‘System.Random’
It is a member of the hidden package ‘random-1.1’.
Perhaps you need to add ‘random’ to the build-depends in your .cabal file.

There are a few possibilities:

  • We could expect that the student should submit the package.yaml that includes random under dependencies, just like how we expect that if students use any dependencies they submit package.yaml. This is the status quo. If this is the decision, the action is to close this issue and do nothing more.
  • Or we could add random to https://github.com/exercism/haskell/blob/main/exercises/practice/robot-name/package.yaml, presuming that every student who wants to solve this exercise will use it. This is a fine presumption because you might still get something that passes the tests without using random if you assign IDs sequentially, though you'd sort of be going against the spirit of the tests. If this is the decision, the action is to submit such a PR, which I would approve as long as it sufficiently summarises the above reasoning ("you might still get something that passe the tests without using random if...") and links to this issue using a word in https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue.

If you are viewing this issue and are unsure what decision to make, be assured that you have my support if you choose to make a PR that implements the latter, and that the latter is my current recommendation.

Perhaps there should be some exercise where we explicitly teach students about the necessity of submitting package.yaml when using packages, but that is sounding like a concept exercise to me.

petertseng avatar Jan 25 '22 16:01 petertseng