haskell/wreq

Tests fail to compile on latest nightly (name clash)

mihaimaruseac opened this issue · 5 comments

#107 is solved, but now tests fail on the next step:

    [1 of 2] Compiling Main             ( /private/tmp/mm/wreq-0.5.1.0/Setup.hs, /private/tmp/mm/wreq-0.5.1.0/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/Main.o )
    [2 of 2] Compiling StackSetupShim   ( /Users/leapyear-mihaimaruseac/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /private/tmp/mm/wreq-0.5.1.0/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/StackSetupShim.o )
    Linking /private/tmp/mm/wreq-0.5.1.0/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/setup/setup ...
    Configuring wreq-0.5.1.0...
    Preprocessing library for wreq-0.5.1.0..
    Building library for wreq-0.5.1.0..
    [ 1 of 15] Compiling Network.Wreq.Cache.Store ( Network/Wreq/Cache/Store.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Network/Wreq/Cache/Store.o )
    [ 2 of 15] Compiling Network.Wreq.Internal.OAuth1 ( Network/Wreq/Internal/OAuth1.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Network/Wreq/Internal/OAuth1.o )
    [ 3 of 15] Compiling Network.Wreq.Internal.Types ( Network/Wreq/Internal/Types.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Network/Wreq/Internal/Types.o )
    [ 4 of 15] Compiling Network.Wreq.Lens.Machinery ( Network/Wreq/Lens/Machinery.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Network/Wreq/Lens/Machinery.o )
    [ 5 of 15] Compiling Network.Wreq.Internal.Lens ( Network/Wreq/Internal/Lens.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Network/Wreq/Internal/Lens.o )

    /private/tmp/mm/wreq-0.5.1.0/Network/Wreq/Internal/Lens.hs:45:1: warning: [-Wunused-top-binds]
        Defined but not used: requestManagerOverride
       |
    45 | makeLenses ''HTTP.Request
       | ^^^^^^^^^^^^^^^^^^^^^^^^^
    [ 6 of 15] Compiling Network.Wreq.Internal.AWS ( Network/Wreq/Internal/AWS.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Network/Wreq/Internal/AWS.o )
    [ 7 of 15] Compiling Network.Wreq.Types ( Network/Wreq/Types.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Network/Wreq/Types.o )
    [ 8 of 15] Compiling Network.Wreq.Internal.Link ( Network/Wreq/Internal/Link.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Network/Wreq/Internal/Link.o )
    [ 9 of 15] Compiling Network.Wreq.Lens.TH ( Network/Wreq/Lens/TH.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Network/Wreq/Lens/TH.o )
    [10 of 15] Compiling Network.Wreq.Lens ( Network/Wreq/Lens.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Network/Wreq/Lens.o )
    [11 of 15] Compiling Network.Wreq.Cache ( Network/Wreq/Cache.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Network/Wreq/Cache.o )
    [12 of 15] Compiling Paths_wreq       ( .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/autogen/Paths_wreq.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Paths_wreq.o )
    [13 of 15] Compiling Network.Wreq.Internal ( Network/Wreq/Internal.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Network/Wreq/Internal.o )
    [14 of 15] Compiling Network.Wreq     ( Network/Wreq.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Network/Wreq.o )
    [15 of 15] Compiling Network.Wreq.Session ( Network/Wreq/Session.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Network/Wreq/Session.o )
    Preprocessing test suite 'tests' for wreq-0.5.1.0..
    Building test suite 'tests' for wreq-0.5.1.0..
    [1 of 4] Compiling HttpBin.Server   ( httpbin/HttpBin/Server.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/tests/tests-tmp/HttpBin/Server.o )

    /private/tmp/mm/wreq-0.5.1.0/httpbin/HttpBin/Server.hs:144:7: warning: [-Wname-shadowing]
        This binding for rqHeaders shadows the existing binding
          imported from Snap.Core at httpbin/HttpBin/Server.hs:21:1-16
          (and originally defined in Snap.Internal.Http.Types)
        |
    144 |       rqHeaders = headers req
        |       ^^^^^^^^^
    [2 of 4] Compiling Properties.Store ( tests/Properties/Store.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/tests/tests-tmp/Properties/Store.o )
    [3 of 4] Compiling UnitTests        ( tests/UnitTests.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/tests/tests-tmp/UnitTests.o )

    /private/tmp/mm/wreq-0.5.1.0/tests/UnitTests.hs:46:16: error:
        Ambiguous occurrence Options
        It could refer to either Data.Aeson.Options,
                                 imported from Data.Aeson at tests/UnitTests.hs:15:1-17
                                 (and originally defined in aeson-1.2.3.0:Data.Aeson.Types.Internal)
                              or Wreq.Options,
                                 imported from Network.Wreq.Lens at tests/UnitTests.hs:28:1-24
                                 (and originally defined in wreq-0.5.1.0:Network.Wreq.Internal.Types)
       |
    46 |   , getWith :: Options -> String -> IO (Response L.ByteString)
       |                ^^^^^^^

    /private/tmp/mm/wreq-0.5.1.0/tests/UnitTests.hs:48:41: error:
        Ambiguous occurrence Options
        It could refer to either Data.Aeson.Options,
                                 imported from Data.Aeson at tests/UnitTests.hs:15:1-17
                                 (and originally defined in aeson-1.2.3.0:Data.Aeson.Types.Internal)
                              or Wreq.Options,
                                 imported from Network.Wreq.Lens at tests/UnitTests.hs:28:1-24
                                 (and originally defined in wreq-0.5.1.0:Network.Wreq.Internal.Types)
       |
    48 |   , postWith :: forall a. Postable a => Options -> String -> a
       |                                         ^^^^^^^

    /private/tmp/mm/wreq-0.5.1.0/tests/UnitTests.hs:51:17: error:
        Ambiguous occurrence Options
        It could refer to either Data.Aeson.Options,
                                 imported from Data.Aeson at tests/UnitTests.hs:15:1-17
                                 (and originally defined in aeson-1.2.3.0:Data.Aeson.Types.Internal)
                              or Wreq.Options,
                                 imported from Network.Wreq.Lens at tests/UnitTests.hs:28:1-24
                                 (and originally defined in wreq-0.5.1.0:Network.Wreq.Internal.Types)
       |
    51 |   , headWith :: Options -> String -> IO (Response ())
       |                 ^^^^^^^

    /private/tmp/mm/wreq-0.5.1.0/tests/UnitTests.hs:53:39: error:
        Ambiguous occurrence Options
        It could refer to either Data.Aeson.Options,
                                 imported from Data.Aeson at tests/UnitTests.hs:15:1-17
                                 (and originally defined in aeson-1.2.3.0:Data.Aeson.Types.Internal)
                              or Wreq.Options,
                                 imported from Network.Wreq.Lens at tests/UnitTests.hs:28:1-24
                                 (and originally defined in wreq-0.5.1.0:Network.Wreq.Internal.Types)
       |
    53 |   , putWith :: forall a. Putable a => Options -> String -> a -> IO (Response L.ByteString)
       |                                       ^^^^^^^

    /private/tmp/mm/wreq-0.5.1.0/tests/UnitTests.hs:55:20: error:
        Ambiguous occurrence Options
        It could refer to either Data.Aeson.Options,
                                 imported from Data.Aeson at tests/UnitTests.hs:15:1-17
                                 (and originally defined in aeson-1.2.3.0:Data.Aeson.Types.Internal)
                              or Wreq.Options,
                                 imported from Network.Wreq.Lens at tests/UnitTests.hs:28:1-24
                                 (and originally defined in wreq-0.5.1.0:Network.Wreq.Internal.Types)
       |
    55 |   , optionsWith :: Options -> String -> IO (Response ())
       |                    ^^^^^^^

    /private/tmp/mm/wreq-0.5.1.0/tests/UnitTests.hs:57:19: error:
        Ambiguous occurrence Options
        It could refer to either Data.Aeson.Options,
                                 imported from Data.Aeson at tests/UnitTests.hs:15:1-17
                                 (and originally defined in aeson-1.2.3.0:Data.Aeson.Types.Internal)
                              or Wreq.Options,
                                 imported from Network.Wreq.Lens at tests/UnitTests.hs:28:1-24
                                 (and originally defined in wreq-0.5.1.0:Network.Wreq.Internal.Types)
       |
    57 |   , deleteWith :: Options -> String -> IO (Response L.ByteString)
       |                   ^^^^^^^

That's weird. I am running 'stack test' with lts-10.1 and with nightly-2018-01-01 and it seems to work. The import of Aeson on line 15 is import Data.Aeson hiding (Options), so that should be OK as well. I'm testing this on HEAD, is this the version you are trying? I will try to release 0.5.2.0 soon.

I'm testing with the 0.5.1.0 on Hackage:

[mm] λ stack unpack wreq-0.5.1.0
Unpacked wreq-0.5.1.0 to /private/tmp/mm/wreq-0.5.1.0/
[mm] λ cd wreq-0.5.1.0
[wreq-0.5.1.0] λ stack init --resolver nightly
...
Selected resolver: nightly-2018-01-01
...
[wreq-0.5.1.0] λ stack build --resolver nightly --haddock --test --bench --no-run-benchmarks --no-run-tests
Selected resolver: nightly-2018-01-01
...
    [3 of 4] Compiling UnitTests        ( tests/UnitTests.hs, .stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/tests/tests-tmp/UnitTests.o )

    /private/tmp/mm/wreq-0.5.1.0/tests/UnitTests.hs:46:16: error:
        Ambiguous occurrence ‘Options’
        It could refer to either ‘Data.Aeson.Options’,
                                 imported from ‘Data.Aeson’ at tests/UnitTests.hs:15:1-17
                                 (and originally defined in ‘aeson-1.2.3.0:Data.Aeson.Types.Internal’)
                              or ‘Wreq.Options’,
                                 imported from ‘Network.Wreq.Lens’ at tests/UnitTests.hs:28:1-24
                                 (and originally defined in ‘wreq-0.5.1.0:Network.Wreq.Internal.Types’)
       |
    46 |   , getWith :: Options -> String -> IO (Response L.ByteString)
       |                ^^^^^^^
...

Also, checking the file, I see the following near line 15:

import Control.Monad (unless, void)
import Data.Aeson
import Data.Aeson.Lens (key, AsValue, _Object)

So, the version I'm using doesn't have the fix but most likely 0.5.2.0 will solve the issue since you already have the proper import.

I have just release 0.5.2.0, can you tryit?

That solves it. However, stackage won't be able to use the new version due to commercialhaskell/stackage#3158 so I'll keep the tests disabled for now

ret commented

Ah, yes. I solved the Options conflict as part of #111, which ondrap kindly merged on 12/23 and is now in 0.5.2.0 (see note: #111 (comment)). Should probably have made this a separate pull, sorry.