Add OVERLAPPING pragma to instances in ClientSpec
This commit is contained in:
parent
7529d7f776
commit
a08e644333
1 changed files with 27 additions and 9 deletions
|
@ -6,8 +6,10 @@
|
|||
{-# LANGUAGE FunctionalDependencies #-}
|
||||
{-# LANGUAGE GADTs #-}
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
#if !MIN_VERSION_base(4,8,0)
|
||||
{-# LANGUAGE OverlappingInstances #-}
|
||||
#endif
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE PolyKinds #-}
|
||||
{-# LANGUAGE RecordWildCards #-}
|
||||
{-# LANGUAGE StandaloneDeriving #-}
|
||||
|
@ -347,17 +349,33 @@ pathGen = fmap NonEmpty path
|
|||
class GetNth (n :: Nat) a b | n a -> b where
|
||||
getNth :: Proxy n -> a -> b
|
||||
|
||||
instance GetNth 0 (x :<|> y) x where
|
||||
getNth _ (x :<|> _) = x
|
||||
instance
|
||||
#if MIN_VERSION_base(4,8,0)
|
||||
{-# OVERLAPPING #-}
|
||||
#endif
|
||||
GetNth 0 (x :<|> y) x where
|
||||
getNth _ (x :<|> _) = x
|
||||
|
||||
instance (GetNth (n - 1) x y) => GetNth n (a :<|> x) y where
|
||||
getNth _ (_ :<|> x) = getNth (Proxy :: Proxy (n - 1)) x
|
||||
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
|
||||
|
||||
class GetLast a b | a -> b where
|
||||
getLast :: a -> b
|
||||
|
||||
instance (GetLast b c) => GetLast (a :<|> b) c where
|
||||
getLast (_ :<|> b) = getLast b
|
||||
instance
|
||||
#if MIN_VERSION_base(4,8,0)
|
||||
{-# OVERLAPPING #-}
|
||||
#endif
|
||||
(GetLast b c) => GetLast (a :<|> b) c where
|
||||
getLast (_ :<|> b) = getLast b
|
||||
|
||||
instance GetLast a a where
|
||||
getLast a = a
|
||||
instance
|
||||
#if MIN_VERSION_base(4,8,0)
|
||||
{-# OVERLAPPING #-}
|
||||
#endif
|
||||
GetLast a a where
|
||||
getLast a = a
|
||||
|
|
Loading…
Reference in a new issue