I’m having a problem submitting my solution to the Bob exercise on the Haskell track. I added a dependency (text-latin1
) to package.yaml
so I could import Text.Ascii
into my solution. This seems to cause the site’s test suite to fail, though they all pass in the cli.
package.yaml:
name: bob
version: 1.4.0.10
dependencies:
- base
- text
- text-latin1
library:
exposed-modules: Bob
source-dirs: src
ghc-options: -Wall
dependencies:
- text
- text-latin1
tests:
test:
main: Tests.hs
source-dirs: test
dependencies:
- bob
- hspec
my solution:
{-# Language OverloadedStrings #-}
module Bob (responseFor) where
import qualified Data.Text as T
import Data.Text ( Text )
import qualified Text.Ascii as A
responseFor :: String -> Text
responseFor xs
| silence = "Fine. Be that way!"
| wtf = "Calm down, I know what I'm doing!"
| shout = "Whoa, chill out!"
| query = "Sure."
| otherwise = "Whatever."
where
txt = T.strip $ T.pack xs
silence = T.null txt
query = T.last txt == '?'
hasAlpha = T.any A.isAlpha txt
hasNoLower = not $ T.any A.isLower txt
shout = hasAlpha && hasNoLower
wtf = shout && query
error message on the site:
Cabal file info not found for text-latin1-0.3.1@sha256:f7da16a5447d51d5de0992a5ecb11ecf3e03d2da9a4f3f66da4e8b3f59a3f3e7,1215, 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))