-
Notifications
You must be signed in to change notification settings - Fork 67
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
GHC 8.10 and 9.0 Compatibility #131
base: master
Are you sure you want to change the base?
Conversation
Add compatibility with servant-client 0.17 and 0.18 Update to newer version of cabal file spec. Add upper and lower bounds on all dependencies. Builds under GHC 8.6.5 through 9.0.1 Should be compatible with Stackage lts 14.0 through 18.16
Hey! Thanks a lot for the effort. Are there any plans to merge this? |
Thanks for this PR! I’m trying to use it with nixpks-22.05, but am hitting
(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; Patch~/build/haskell/haskell-telegram-api $ git diff
diff --git a/src/Servant/Client/MultipartFormData.hs b/src/Servant/Client/MultipartFormData.hs
index 1b6d17d..01e8f75 100644
--- a/src/Servant/Client/MultipartFormData.hs
+++ b/src/Servant/Client/MultipartFormData.hs
@@ -36,7 +36,7 @@ import Network.HTTP.Types
import qualified Network.HTTP.Types as H
import qualified Network.HTTP.Types.Header as HTTP
import Servant.API
-import Servant.Client
+import Servant.Client hiding ((//))
import qualified Servant.Client.Core as Core
import Servant.Client.Internal.HttpClient (catchConnectionError, clientResponseToResponse)
#if !MIN_VERSION_servant_client(0,17,0)
diff --git a/telegram-api.cabal b/telegram-api.cabal
index 5d54cd7..e23ca17 100644
--- a/telegram-api.cabal
+++ b/telegram-api.cabal
@@ -47,13 +47,13 @@ library
, Web.Telegram.API.Bot.API.Core
, Servant.Client.MultipartFormData
build-depends: base >= 4.7 && < 5
- , aeson ^>= {1.4.4, 1.5.6}
- , containers ^>= 0.6.0
+ , aeson ^>= {1.4.4, 1.5.6, 2.0.2}
+ , containers ^>= 0.6.0
, http-api-data ^>= 0.4.1
, http-client ^>= {0.6.4, 0.7.0}
- , servant (>= 0.16 && < 0.18) || ^>= 0.18
- , servant-client (>= 0.16 && < 0.18) || ^>= 0.18
- , servant-client-core (>= 0.16 && < 0.18) || ^>= 0.18
+ , servant (>= 0.16 && < 0.18) || ^>= {0.18, 0.19}
+ , servant-client (>= 0.16 && < 0.18) || ^>= {0.18, 0.19}
+ , servant-client-core (>= 0.16 && < 0.18) || ^>= {0.18, 0.19}
, mtl ^>= 2.2.2
, text ^>= 1.2.3
, transformers ^>= 0.5.6 But I am not sure what to do about
and unfortunately, https://hackage.haskell.org/package/servant-client-core-0.19/changelog does not give any migration advise. |
This might work? It typechecks :-)
|
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.