git.iko.soy/typeable/servant
on master help sign in
Add OVERLAPPING pragma to instances in ClientSpec
a08e644Arian van Putten
servant-client/test/Servant/ClientSpec.hs+27−9
@@ -6,8 +6,10 @@
6{-# LANGUAGE FunctionalDependencies #-}
6{-# LANGUAGE FunctionalDependencies #-}
7{-# LANGUAGE GADTs #-}
7{-# LANGUAGE GADTs #-}
8{-# LANGUAGE MultiParamTypeClasses #-}
8{-# LANGUAGE MultiParamTypeClasses #-}
9−{-# LANGUAGE OverloadedStrings #-}
9+#if !MIN_VERSION_base(4,8,0)
10{-# LANGUAGE OverlappingInstances #-}
10{-# LANGUAGE OverlappingInstances #-}
11+#endif
12+{-# LANGUAGE OverloadedStrings #-}
11{-# LANGUAGE PolyKinds #-}
13{-# LANGUAGE PolyKinds #-}
12{-# LANGUAGE RecordWildCards #-}
14{-# LANGUAGE RecordWildCards #-}
13{-# LANGUAGE StandaloneDeriving #-}
15{-# LANGUAGE StandaloneDeriving #-}
@@ -347,17 +349,33 @@ pathGen = fmap NonEmpty path
347class GetNth (n :: Nat) a b | n a -> b where
349class GetNth (n :: Nat) a b | n a -> b where
348 getNth :: Proxy n -> a -> b
350 getNth :: Proxy n -> a -> b
349
351
352+instance
353+#if MIN_VERSION_base(4,8,0)
354+ {-# OVERLAPPING #-}
355+#endif
350−instance GetNth 0 (x :<|> y) x where
356+ GetNth 0 (x :<|> y) x where
351− getNth _ (x :<|> _) = x
357+ getNth _ (x :<|> _) = x
352
358
359+instance
360+#if MIN_VERSION_base(4,8,0)
361+ {-# OVERLAPPING #-}
362+#endif
353−instance (GetNth (n - 1) x y) => GetNth n (a :<|> x) y where
363+ (GetNth (n - 1) x y) => GetNth n (a :<|> x) y where
354− getNth _ (_ :<|> x) = getNth (Proxy :: Proxy (n - 1)) x
364+ getNth _ (_ :<|> x) = getNth (Proxy :: Proxy (n - 1)) x
355
365
356class GetLast a b | a -> b where
366class GetLast a b | a -> b where
357 getLast :: a -> b
367 getLast :: a -> b
358
368
369+instance
370+#if MIN_VERSION_base(4,8,0)
371+ {-# OVERLAPPING #-}
372+#endif
359−instance (GetLast b c) => GetLast (a :<|> b) c where
373+ (GetLast b c) => GetLast (a :<|> b) c where
360− getLast (_ :<|> b) = getLast b
374+ getLast (_ :<|> b) = getLast b
361
375
376+instance
377+#if MIN_VERSION_base(4,8,0)
378+ {-# OVERLAPPING #-}
379+#endif
362−instance GetLast a a where
380+ GetLast a a where
363− getLast a = a
381+ getLast a = a