on master help sign in
Fix TypeError for GHC-9.4
4627683Teo Camarasu
servant-server/src/Servant/Server/Internal.hs+4−2
@@ -94,6 +94,8 @@ import Servant.API.TypeErrors
94import Web.HttpApiData
94import Web.HttpApiData
95 (FromHttpApiData, parseHeader, parseQueryParam, parseUrlPiece,
95 (FromHttpApiData, parseHeader, parseQueryParam, parseUrlPiece,
96 parseUrlPieces)
96 parseUrlPieces)
97+import Data.Kind
98+ (Type)
97
99
98import Servant.Server.Internal.BasicAuth
100import Servant.Server.Internal.BasicAuth
99import Servant.Server.Internal.Context
101import Servant.Server.Internal.Context
@@ -821,7 +823,7 @@ instance (HasContextEntry context (NamedContext name subContext), HasServer subA
821-------------------------------------------------------------------------------
823-------------------------------------------------------------------------------
822
824
823-- Erroring instance for 'HasServer' when a combinator is not fully applied
825-- Erroring instance for 'HasServer' when a combinator is not fully applied
824−instance TypeError (PartialApplication HasServer arr) => HasServer ((arr :: a -> b) :> sub) context
826+instance TypeError (PartialApplication @(Type -> [Type] -> Constraint) HasServer arr) => HasServer ((arr :: a -> b) :> sub) context
825 where
827 where
826 type ServerT (arr :> sub) _ = TypeError (PartialApplication (HasServer :: * -> [*] -> Constraint) arr)
828 type ServerT (arr :> sub) _ = TypeError (PartialApplication (HasServer :: * -> [*] -> Constraint) arr)
827 route = error "unreachable"
829 route = error "unreachable"
@@ -865,7 +867,7 @@ type HasServerArrowTypeError a b =
865-- XXX: This omits the @context@ parameter, e.g.:
867-- XXX: This omits the @context@ parameter, e.g.:
866--
868--
867-- "There is no instance for HasServer (Bool :> …)". Do we care ?
869-- "There is no instance for HasServer (Bool :> …)". Do we care ?
868−instance {-# OVERLAPPABLE #-} TypeError (NoInstanceForSub HasServer ty) => HasServer (ty :> sub) context
870+instance {-# OVERLAPPABLE #-} TypeError (NoInstanceForSub @(Type -> [Type] -> Constraint) HasServer ty) => HasServer (ty :> sub) context
869
871
870instance {-# OVERLAPPABLE #-} TypeError (NoInstanceFor (HasServer api context)) => HasServer api context
872instance {-# OVERLAPPABLE #-} TypeError (NoInstanceFor (HasServer api context)) => HasServer api context
871
873
servant/src/Servant/Links.hs+4−2
@@ -193,6 +193,8 @@ import Servant.API.Verbs
193import Servant.API.WithNamedContext
193import Servant.API.WithNamedContext
194 (WithNamedContext)
194 (WithNamedContext)
195import Web.HttpApiData
195import Web.HttpApiData
196+import Data.Kind
197+ (Type)
196
198
197-- | A safe link datatype.
199-- | A safe link datatype.
198-- The only way of constructing a 'Link' is using 'safeLink', which means any
200-- The only way of constructing a 'Link' is using 'safeLink', which means any
@@ -647,12 +649,12 @@ simpleToLink _ toA _ = toLink toA (Proxy :: Proxy sub)
647-- >>> import Data.Text (Text)
649-- >>> import Data.Text (Text)
648
650
649-- Erroring instance for 'HasLink' when a combinator is not fully applied
651-- Erroring instance for 'HasLink' when a combinator is not fully applied
650−instance TypeError (PartialApplication HasLink arr) => HasLink ((arr :: a -> b) :> sub)
652+instance TypeError (PartialApplication @(Type -> Constraint) HasLink arr) => HasLink ((arr :: a -> b) :> sub)
651 where
653 where
652 type MkLink (arr :> sub) _ = TypeError (PartialApplication (HasLink :: * -> Constraint) arr)
654 type MkLink (arr :> sub) _ = TypeError (PartialApplication (HasLink :: * -> Constraint) arr)
653 toLink = error "unreachable"
655 toLink = error "unreachable"
654
656
655-- Erroring instances for 'HasLink' for unknown API combinators
657-- Erroring instances for 'HasLink' for unknown API combinators
656−instance {-# OVERLAPPABLE #-} TypeError (NoInstanceForSub HasLink ty) => HasLink (ty :> sub)
658+instance {-# OVERLAPPABLE #-} TypeError (NoInstanceForSub @(Type -> Constraint) HasLink ty) => HasLink (ty :> sub)
657
659
658instance {-# OVERLAPPABLE #-} TypeError (NoInstanceFor (HasLink api)) => HasLink api
660instance {-# OVERLAPPABLE #-} TypeError (NoInstanceFor (HasLink api)) => HasLink api