Add OVERLAPPING pragma to instances in ClientSpec

This commit is contained in:
Arian van Putten 2015-10-09 00:48:03 +02:00
parent 7529d7f776
commit a08e644333

View file

@ -6,8 +6,10 @@
{-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GADTs #-} {-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-} #if !MIN_VERSION_base(4,8,0)
{-# LANGUAGE OverlappingInstances #-} {-# LANGUAGE OverlappingInstances #-}
#endif
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PolyKinds #-} {-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE StandaloneDeriving #-}
@ -347,17 +349,33 @@ pathGen = fmap NonEmpty path
class GetNth (n :: Nat) a b | n a -> b where class GetNth (n :: Nat) a b | n a -> b where
getNth :: Proxy n -> a -> b getNth :: Proxy n -> a -> b
instance GetNth 0 (x :<|> y) x where instance
#if MIN_VERSION_base(4,8,0)
{-# OVERLAPPING #-}
#endif
GetNth 0 (x :<|> y) x where
getNth _ (x :<|> _) = x getNth _ (x :<|> _) = x
instance (GetNth (n - 1) x y) => GetNth n (a :<|> x) y where instance
#if MIN_VERSION_base(4,8,0)
{-# OVERLAPPING #-}
#endif
(GetNth (n - 1) x y) => GetNth n (a :<|> x) y where
getNth _ (_ :<|> x) = getNth (Proxy :: Proxy (n - 1)) x getNth _ (_ :<|> x) = getNth (Proxy :: Proxy (n - 1)) x
class GetLast a b | a -> b where class GetLast a b | a -> b where
getLast :: a -> b getLast :: a -> b
instance (GetLast b c) => GetLast (a :<|> b) c where instance
#if MIN_VERSION_base(4,8,0)
{-# OVERLAPPING #-}
#endif
(GetLast b c) => GetLast (a :<|> b) c where
getLast (_ :<|> b) = getLast b getLast (_ :<|> b) = getLast b
instance GetLast a a where instance
#if MIN_VERSION_base(4,8,0)
{-# OVERLAPPING #-}
#endif
GetLast a a where
getLast a = a getLast a = a