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

Compile failure #1

Open
hvr opened this issue May 31, 2017 · 3 comments
Open

Compile failure #1

hvr opened this issue May 31, 2017 · 3 comments

Comments

@hvr
Copy link

hvr commented May 31, 2017

See also https://matrix.hackage.haskell.org/package/wai-middleware-json-errors

This is most likely caused due to missing or inaccurate version bounds:

Configuring component lib from wai-middleware-json-errors-0.1.0...
Preprocessing library wai-middleware-json-errors-0.1.0...
[1 of 2] Compiling Paths_wai_middleware_json_errors ( /tmp/matrix-worker/1496252162/dist-newstyle/build/x86_64-linux/ghc-7.10.3/wai-middleware-json-errors-0.1.0/build/autogen/Paths_wai_middleware_json_errors.hs, /tmp/matrix-worker/1496252162/dist-newstyle/build/x86_64-linux/ghc-7.10.3/wai-middleware-json-errors-0.1.0/build/Paths_wai_middleware_json_errors.o )
[2 of 2] Compiling Network.Wai.Middleware.JsonErrors ( src/Network/Wai/Middleware/JsonErrors.hs, /tmp/matrix-worker/1496252162/dist-newstyle/build/x86_64-linux/ghc-7.10.3/wai-middleware-json-errors-0.1.0/build/Network/Wai/Middleware/JsonErrors.o )

src/Network/Wai/Middleware/JsonErrors.hs:45:7:
    Couldn't match expected type ‘Data.ByteString.Builder.Internal.Builder’
                with actual type ‘binary-0.7.5.0:Data.Binary.Builder.Base.Builder’
    NB: ‘Data.ByteString.Builder.Internal.Builder’
          is defined in ‘Data.ByteString.Builder.Internal’
              in package ‘bytestring-0.10.6.0’
        ‘binary-0.7.5.0:Data.Binary.Builder.Base.Builder’
          is defined in ‘Data.Binary.Builder.Base’
              in package ‘binary-0.7.5.0’
    In the second argument of ‘($)’, namely
      ‘fromLazyByteString
       $ encode
         $ object
             ["error" .= String (decodeUtf8 $ toStrict b),
              "status" .= Number (fromIntegral $ statusCode s)]’
    In the expression:
      responseBuilder s (("Content-Type", "application/json") : hs)
      $ fromLazyByteString
        $ encode
          $ object
              ["error" .= String (decodeUtf8 $ toStrict b),
               "status" .= Number (fromIntegral $ statusCode s)]
    In an equation for ‘jsonErrorResponse’:
        jsonErrorResponse s hs b
          = responseBuilder s (("Content-Type", "application/json") : hs)
            $ fromLazyByteString
              $ encode
                $ object
                    ["error" .= String (decodeUtf8 $ toStrict b),
                     "status" .= Number (fromIntegral $ statusCode s)]

src/Network/Wai/Middleware/JsonErrors.hs:52:63:
    Couldn't match expected type ‘binary-0.7.5.0:Data.Binary.Builder.Base.Builder’
                with actual type ‘Data.ByteString.Builder.Internal.Builder’
    NB: ‘binary-0.7.5.0:Data.Binary.Builder.Base.Builder’
          is defined in ‘Data.Binary.Builder.Base’
              in package ‘binary-0.7.5.0’
        ‘Data.ByteString.Builder.Internal.Builder’
          is defined in ‘Data.ByteString.Builder.Internal’
              in package ‘bytestring-0.10.6.0’
    In the first argument of ‘toLazyByteString’, namely ‘b’
    In the first argument of ‘Just’, namely ‘(toLazyByteString b)’
@seanhess
Copy link
Member

seanhess commented May 31, 2017 via email

@hvr
Copy link
Author

hvr commented May 31, 2017

@seanhess as it seems you're using Stack, I think the simplest proper way would be to add pvp-bounds: both (see docs here) to your stack.yaml file, and use (mostly) the version bounds inferred from the stackage snapshot used.

I've emulated more or less what pvp-bounds: both does with the help of staversion (as I don't have Stack installed), and after some trial & error and tweaking the bounds, I came up with the following bounds which I've already revised into the affected release:

  build-depends:
      aeson >=1.0.2.1 && <1.3
    , binary >=0.8.3 && <0.9
    , bytestring >=0.10.6 && <0.11
    , http-types >=0.9.1 && <0.10
    , text >=1.2.2.1 && <1.3
    , wai >=3.2.1.1 && <3.3
    , base >=4.8 && <5

And now it's all green at https://matrix.hackage.haskell.org/package/wai-middleware-json-errors
(but note that GHC 7.8.4 support had to be dropped, as the source code assumes a post-AMP prelude; but it's no big deal; GHC 7.8.4 is quite old by now).

@seanhess
Copy link
Member

seanhess commented May 31, 2017 via email

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