git.iko.soy/typeable/servant
on master help sign in
Exclude quantified constraints code for GHCJS

QuantifiedConstraints isn't available for GHC 8.4 (where our GHCJS version is still stuck). We may need to take a drastic decision for GHCJS at some point.

commit861cd4f997ee454d8a3d575db200260faa7293c0 authorGaël Deest <gael.deest@tweag.io> dateSat 2 Oct 2021, 17:32 (5 years ago) parent5ead291
2 files changed+20−1
servant-client-core/src/Servant/Client/Generic.hs+10−1 servant-server/src/Servant/Server/Generic.hs+10
servant-client-core/src/Servant/Client/Generic.hs+10−1
@@ -1,16 +1,21 @@
11{-# OPTIONS_GHC -fno-warn-orphans #-}
22{-# LANGUAGE ConstraintKinds #-}
3+{-# LANGUAGE CPP #-}
34{-# LANGUAGE FlexibleContexts #-}
45{-# LANGUAGE FlexibleInstances #-}
56{-# LANGUAGE InstanceSigs #-}
67{-# LANGUAGE KindSignatures #-}
78{-# LANGUAGE MultiParamTypeClasses #-}
8−{-# LANGUAGE QuantifiedConstraints #-}
99{-# LANGUAGE RankNTypes #-}
1010{-# LANGUAGE ScopedTypeVariables #-}
1111{-# LANGUAGE TypeApplications #-}
1212{-# LANGUAGE TypeFamilies #-}
1313{-# LANGUAGE UndecidableInstances #-}
14+
15+#if __GLASGOW_HASKELL__ >= 806
16+{-# LANGUAGE QuantifiedConstraints #-}
17+#endif
18+
1419module Servant.Client.Generic (
1520 AsClientT,
1621 genericClient,
@@ -58,6 +63,8 @@ genericClientHoist nt
5863 m = Proxy :: Proxy m
5964 api = Proxy :: Proxy (ToServantApi routes)
6065
66+#if __GLASGOW_HASKELL__ >= 806
67+
6168type GClientConstraints api m =
6269 ( GenericServant api (AsClientT m)
6370 , Client m (ToServantApi api) ~ ToServant api (AsClientT m)
@@ -95,3 +102,5 @@ instance
95102 fromServant @api @(AsClientT mb) $
96103 hoistClientMonad @m @(ToServantApi api) @ma @mb Proxy Proxy nat $
97104 toServant @api @(AsClientT ma) clientA
105+
106+#endif
servant-server/src/Servant/Server/Generic.hs+10
@@ -1,6 +1,7 @@
11{-# OPTIONS_GHC -fno-warn-orphans #-}
22{-# LANGUAGE AllowAmbiguousTypes #-}
33{-# LANGUAGE ConstraintKinds #-}
4+{-# LANGUAGE CPP #-}
45{-# LANGUAGE DataKinds #-}
56{-# LANGUAGE DefaultSignatures #-}
67{-# LANGUAGE FlexibleContexts #-}
@@ -15,6 +16,11 @@
1516{-# LANGUAGE TypeFamilies #-}
1617{-# LANGUAGE TypeOperators #-}
1718{-# LANGUAGE UndecidableInstances #-}
19+
20+#if __GLASGOW_HASKELL__ >= 806
21+{-# LANGUAGE QuantifiedConstraints #-}
22+#endif
23+
1824-- | @since 0.14.1
1925module Servant.Server.Generic (
2026 AsServerT,
@@ -113,6 +119,8 @@ genericServerT
113119 -> ToServant routes (AsServerT m)
114120genericServerT = toServant
115121
122+#if __GLASGOW_HASKELL__ >= 806
123+
116124-- | Set of constraints required to convert to / from vanilla server types.
117125type GServerConstraints api m =
118126 ( ToServant api (AsServerT m) ~ ServerT (ToServantApi api) m
@@ -173,3 +181,5 @@ instance
173181 toServant server
174182 servantSrvN :: ServerT (ToServantApi api) n =
175183 hoistServerWithContext (Proxy @(ToServantApi api)) pctx nat servantSrvM
184+
185+#endif