Open DrewFenwick opened 3 years ago
Hey! Thanks a lot for the effort.
Are there any plans to merge this? The repo seems a bit abandonded.
Thanks for this PR! I’m trying to use it with nixpks-22.05, but am hitting
[ 1 of 16] Compiling Servant.Client.MultipartFormData ( src/Servant/Client/MultipartFormData.hs, dist/build/Servant/Client/MultipartFormData.o )
src/Servant/Client/MultipartFormData.hs:94:49: error:
Ambiguous occurrence ‘//’
It could refer to
either ‘Network.HTTP.Media.//’,
imported from ‘Network.HTTP.Media’ at src/Servant/Client/MultipartFormData.hs:34:1-35
(and originally defined in ‘Network.HTTP.Media.MediaType’)
or ‘Servant.Client.//’,
imported from ‘Servant.Client’ at src/Servant/Client/MultipartFormData.hs:39:1-31
(and originally defined in ‘Servant.Client.Core.HasClient’)
|
94 | Nothing -> pure $ "application"//"octet-stream"
| ^^
(Ok, granted, I am forcing the use of the dependencies provided by nixpkgs-22.05, so I should probably investigate myself…)
As @ppmdo says, this repo seems to be relatively abandonned. Do you maybe want to take over the package, @DrewFenwick?
Ok, that one is easy to fix;
But I am not sure what to do about
[ 1 of 16] Compiling Servant.Client.MultipartFormData ( src/Servant/Client/MultipartFormData.hs, dist/build/Servant/Client/MultipartFormData.o )
src/Servant/Client/MultipartFormData.hs:55:10: warning: [-Wmissing-methods]
• No explicit implementation for
‘hoistClientMonad’
• In the instance declaration for
‘HasClient m (MultipartFormDataReqBody b :> Post cts' a)’
|
55 | instance (Core.RunClient m, ToMultipartFormData b, MimeUnrender ct a, cts' ~ (ct ': cts)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
and unfortunately, https://hackage.haskell.org/package/servant-client-core-0.19/changelog does not give any migration advise.
This might work? It typechecks :-)
#if MIN_VERSION_servant_client(0,19,0)
hoistClientMonad _ _ _ ma = ma
#endif
This PR does four things:
Thanks mostly thanks to the loosening of the servant constraints, I have been able to successfully build this package under GHC 8.6.5, 8.8.4, 8.10.7 and 9.0.1
Tests
The test repairs cover 3 problems:
runIntegrationSpec
expectedSpecWith
to satisfy theMonadFail
constraint which isn't the case (at least with with modernhspec
versions).⚠The addition of the
sticker_file_unique_id
adds to the interface so at least a minor version bump will be required on release.What this doesn't do is guarantee that all tests are working nor fix all failing tests that may be a result from incompatibilities with the current version of the Telegram API.
Servant-Client Compatibility
Most of the incompatibility seemed to come from dependence on internal servant modules which subsequently underwent minor changes like renamings.
The fixes should be simple and self-explanatory. All tests except 1 passed, which I believe to be is unrelated and caused by an outdated hardcoded file id
This fixes #132
To maintain compatibility between both old and new versions of servant I had to resort to a little CPP usage. I'd prefer to avoid it since in my experience it tends to cause problems with tooling, but dropping compatability with servant-client 0.16 would also drop support with stackage LTS 14, 15 and 16 and therefore support for GHC 8.6 and 8.8 for stackage users.
I expect it may be possible to avoid depending on the internal modules to make this less of an issue.
Upping the Cabal Spec Version
The cabal file was originally on
cabal-version >=1.10
Later cabal versions add convenient improvements to cabal file syntax and also provide more information so that tools lik HLS can function, IIRC, such as through the autogen-modules field.I don't think it likely that there are any users out there who desperately need support for old versions of cabal or stack so I don't think it's too much of an issue to drop support for them.
As such I've upped the
cabal-version
to3.4
, and made some adjustments to make it compliant.Dependency bounds.
I have added upper and lower bounds to every library dependency in accordance with the Hackage PVP. This will avoid tools resolving build plans that seem valid but lead to build errors.
These bounds are broad enough to build on GHC 8.6.5 through to GHC 9.0.1 according to my testing.
This fixes #130.
The dependency bounds on servant libs currently look a little odd:
This is because the
^>= 0.18
has subtly different semantics from< 0.19
I could've just done this:
But as more major versions come along those sets are only going to get larger. I'm happy to change it if preferred.