exercism/haskell

Can't download library from Hackage

a12l opened this issue · 11 comments

a12l commented

When I submit my solution to a Haskell exercise, I get an error message in the Tests tab.

The solution works flawlessly on my computer, and the library's source code hasn't changed in two years.

Cabal file info not found for multiset-0.3.4.3@sha256:968192524bd38ffa29856e1e3f9f6f8a5704f98899d4b25f8ebd425001594f61,1790, updating
Selected mirror https://hackage.haskell.org/
Downloading root
HttpExceptionRequest Request {
  host                 = "hackage.haskell.org"
  port                 = 443
  secure               = True
  requestHeaders       = [("Accept-Encoding",""),("User-Agent","Haskell pantry package")]
  path                 = "/root.json"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 (ConnectionFailure Network.Socket.getAddrInfo (called with preferred socket type/protocol: AddrInfo {addrFlags = [AI_ADDRCONFIG], addrFamily = AF_UNSPEC, addrSocketType = Stream, addrProtocol = 0, addrAddress = <assumed to be undefined>, addrCanonName = <assumed to be undefined>}, host name: Just "hackage.haskell.org", service name: Just "443"): does not exist (Try again))

My package.yaml file

name: anagram
version: 1.4.0.8

dependencies:
  - base
  - text
  - containers
  - multiset

library:
  exposed-modules: Anagram
  source-dirs: src
  ghc-options: -Wall
  # dependencies:
  # - foo       # List here the packages you
  # - bar       # want to use in your solution.

tests:
  test:
    main: Tests.hs
    source-dirs: test
    dependencies:
      - anagram
      - hspec

The library's Cabal file is can be found here: https://github.com/twanvl/multiset/blob/master/multiset.cabal, and the library is listed on Hackage here: https://hackage.haskell.org/package/multiset

NobbZ commented

In general the Testrunner does not have any internet connectivity. You have to solve the exercise with the libraries available in the runner.

On the other hand, and I assume you're using the exercism CLI, you could be satisfied that the solutions are passing on your computer and live with test runner failures. I do this on the Perl5 track where I use modules that aren't installed in the test runner. I've learned to accept the shame of the public failure status on my published solutions.

a12l commented

In general the Testrunner does not have any internet connectivity. You have to solve the exercise with the libraries available in the runner.

From the Haskell Anagram exercise

[...]
Later, it may be a good idea to revisit this problem and play with other data types and libraries:

  • Text, from package text.
  • Sequence and Set, from package containers.
  • MultiSet, from package multiset

[...]

It explicitly says that I should be able to use the library.

NobbZ commented

It says that you might want to play with those libs, not that you will be able to use them on the test runner.

Indeed though I have to be honest. The wording is unfortunate. And perhaps the testrunner can be adjusted to allow usage of those packages, or wording can be adjusted to explicitely warn that submissions using those libs will fail on the test runner?

@exercism/haskell any opinion on this?

a12l commented

It says that you might want to play with those libs, not that you will be able to use them on the test runner.

But the text and the containers packages is available in the environment? I haven't looked at all the Haskell exercises, but both text and containers have never been required, but just been available to "play with".

And for someone that use the live editor, how is one supposed to "play with" multiset if you can't even compile your program? It's like to teach someone programming by giving them a reference book with a pen and paper, but never tell them if what they write even make sense. Feedback loops are important!

a12l commented

@NobbZ Not blaming you personally, it just feels like an obvious bug to me that it isn't available. But the Haskell team should be able to clarify it :)

To fix this issue, multiset should be added to https://github.com/exercism/haskell-test-runner/blob/main/pre-compiled/package.yaml

Reasons why it is appropriate to be added:

  • an exercise instruction mentions it
  • it appears a reasonable number of times in #1006 (comment) which is a count of number of times packages were used
iHiD commented

@petertseng @ErikSchierboom Is this one that either of you can fix? Should this issue be moved to exercism/haskell?

I think it should be moved, and I think this packages should be added.

PR has been opened: exercism/haskell-test-runner#49 Once that is merged and the test runner is deployed (within 15 mins or so after merging), this issue should be fixed.

It has been merged. Within about 15 minutes from now this should be fixed.