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

Consider adding attoparsec to common dependencies for wordy exercise #1044

Closed
mike-barber opened this issue Feb 5, 2022 · 4 comments
Closed

Comments

@mike-barber
Copy link

mike-barber commented Feb 5, 2022

I've been trying to submit a (locally-working) solution to the wordy exercise, but it's failing to download attoparsec due to an HttpExceptionRequest. I am submitting both package.yaml and the source.

I originally used megaparsec but ran into the same issue. The exercise itself suggests that "This is a perfect opportunity to learn some Attoparsec or Parsec!", so I figured attoparsec might be a better option given the recommendation.

I may be missing a workaround here, but from surveying recent issues it appears that packages required need to be baked into the test runner here: pre-compiled/package.yaml, c.f. test runner pr 32

library:
  exposed-modules: LeapYear
  source-dirs: src
  ghc-options: -Wall
  dependencies:
    - QuickCheck
    - lens
    - parallel
    - vector
    - split
    - random
    - string-conversions
    - text

Would the solution to this be to add attoparsec to the above, or is there another workaround I should be using?

EDIT: I've verified that adding attoparsec to the test runner image resolves the problem - tested using ./bin/run-in-docker.sh wordy ... -- still not sure if this is the preferred solution though.

@petertseng
Copy link
Member

I checked the number of occurrences of attoparsec and megaparsec in #1006 (comment), which is the list of how many times a given package was imported in solutions as of October 2021. Given their rate of occurrence plus the fact that we have both https://github.com/exercism/haskell/blob/main/exercises/practice/wordy/.docs/instructions.append.md and https://github.com/exercism/haskell/blob/main/exercises/practice/sgf-parsing/.docs/instructions.append.md suggesting using some parser combinator library, I'm supportive of adding both attoparsec and megaparsec to https://github.com/exercism/haskell-test-runner/blob/main/pre-compiled/package.yaml. Is fine to support multiple options.

@mike-barber
Copy link
Author

Thanks @petertseng -- I've opened a small PR for this :)

Viewing this from the perspective of a new-to-Haskell user, it is quite tricky to know what packages are viable for use in solutions.

I'm wondering whether it would be worth adding a list of them to the documentation in docs/TESTS.md, since they really have to be baked into the image to work. Although I'm not sure how to get a full list since packages pull in other ones, and there are a whole lot included in base too.

@petertseng
Copy link
Member

I'm wondering whether it would be worth adding a list of them to the documentation in docs/TESTS.md,

That is a good idea. I think we did not do it immediately because we were waiting for some long-term thing where, upon submission, the site might be able to detect whether the student used a package that the test runner doesn't have and tell them about that. However, I'm not sure what the path to implementing that long-term solution is, so just listing them in documentation will serve for the time being. My ideas of how to do that have been put in #1045 now.

@mike-barber
Copy link
Author

Thanks for all your help! The issue has been resolved via the linked PR.

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

2 participants