{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE MagicHash #-}

#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE Trustworthy #-}
#endif

#if __GLASGOW_HASKELL__ >= 705
{-# LANGUAGE PolyKinds #-}
#endif

#include "HsBaseConfig.h"

module Generics.Deriving.Eq (
  -- * Generic Eq class
    GEq(..)

  -- * Default definition
  , geqdefault

  -- * Internal Eq class
  , GEq'(..)

  ) where

import           Control.Applicative (Const, ZipList)

import           Data.Char (GeneralCategory)
import           Data.Int
import qualified Data.Monoid as Monoid (First, Last)
import           Data.Monoid (All, Any, Dual, Product, Sum)
import           Data.Version (Version)
import           Data.Word

import           Foreign.C.Error
import           Foreign.C.Types
import           Foreign.ForeignPtr (ForeignPtr)
import           Foreign.Ptr
import           Foreign.StablePtr (StablePtr)

import           Generics.Deriving.Base

import           GHC.Exts hiding (Any)

import           System.Exit (ExitCode)
import           System.IO (BufferMode, Handle, HandlePosn, IOMode, SeekMode)
import           System.IO.Error (IOErrorType)
import           System.Posix.Types

#if MIN_VERSION_base(4,4,0)
import           Data.Complex (Complex)
#endif

#if MIN_VERSION_base(4,7,0)
import           Data.Proxy (Proxy)
#endif

#if MIN_VERSION_base(4,8,0)
import           Data.Functor.Identity (Identity)
import           Data.Monoid (Alt)
import           Data.Void (Void)
import           Numeric.Natural (Natural)
#endif

#if MIN_VERSION_base(4,9,0)
import           Data.List.NonEmpty (NonEmpty)
import qualified Data.Semigroup as Semigroup (First, Last)
import           Data.Semigroup (Arg(..), Max, Min, WrappedMonoid)
#endif

--------------------------------------------------------------------------------
-- Generic show
--------------------------------------------------------------------------------

class GEq' f where
  geq' :: f a -> f a -> Bool

instance GEq' V1 where
  geq' :: V1 a -> V1 a -> Bool
geq' V1 a
_ V1 a
_ = Bool
True

instance GEq' U1 where
  geq' :: U1 a -> U1 a -> Bool
geq' U1 a
_ U1 a
_ = Bool
True

instance (GEq c) => GEq' (K1 i c) where
  geq' :: K1 i c a -> K1 i c a -> Bool
geq' (K1 c
a) (K1 c
b) = c -> c -> Bool
forall a. GEq a => a -> a -> Bool
geq c
a c
b

-- No instances for P or Rec because geq is only applicable to types of kind *

instance (GEq' a) => GEq' (M1 i c a) where
  geq' :: M1 i c a a -> M1 i c a a -> Bool
geq' (M1 a a
a) (M1 a a
b) = a a -> a a -> Bool
forall k (f :: k -> *) (a :: k). GEq' f => f a -> f a -> Bool
geq' a a
a a a
b

instance (GEq' a, GEq' b) => GEq' (a :+: b) where
  geq' :: (:+:) a b a -> (:+:) a b a -> Bool
geq' (L1 a a
a) (L1 a a
b) = a a -> a a -> Bool
forall k (f :: k -> *) (a :: k). GEq' f => f a -> f a -> Bool
geq' a a
a a a
b
  geq' (R1 b a
a) (R1 b a
b) = b a -> b a -> Bool
forall k (f :: k -> *) (a :: k). GEq' f => f a -> f a -> Bool
geq' b a
a b a
b
  geq' (:+:) a b a
_      (:+:) a b a
_      = Bool
False

instance (GEq' a, GEq' b) => GEq' (a :*: b) where
  geq' :: (:*:) a b a -> (:*:) a b a -> Bool
geq' (a a
a1 :*: b a
b1) (a a
a2 :*: b a
b2) = a a -> a a -> Bool
forall k (f :: k -> *) (a :: k). GEq' f => f a -> f a -> Bool
geq' a a
a1 a a
a2 Bool -> Bool -> Bool
&& b a -> b a -> Bool
forall k (f :: k -> *) (a :: k). GEq' f => f a -> f a -> Bool
geq' b a
b1 b a
b2

-- Unboxed types
instance GEq' UAddr where
  geq' :: UAddr a -> UAddr a -> Bool
geq' (UAddr a1) (UAddr a2)     = Int# -> Bool
isTrue# (Addr# -> Addr# -> Int#
eqAddr# Addr#
a1 Addr#
a2)
instance GEq' UChar where
  geq' :: UChar a -> UChar a -> Bool
geq' (UChar c1) (UChar c2)     = Int# -> Bool
isTrue# (Char# -> Char# -> Int#
eqChar# Char#
c1 Char#
c2)
instance GEq' UDouble where
  geq' :: UDouble a -> UDouble a -> Bool
geq' (UDouble d1) (UDouble d2) = Int# -> Bool
isTrue# (Double#
d1 Double# -> Double# -> Int#
==## Double#
d2)
instance GEq' UFloat where
  geq' :: UFloat a -> UFloat a -> Bool
geq' (UFloat f1) (UFloat f2)   = Int# -> Bool
isTrue# (Float# -> Float# -> Int#
eqFloat# Float#
f1 Float#
f2)
instance GEq' UInt where
  geq' :: UInt a -> UInt a -> Bool
geq' (UInt i1) (UInt i2)       = Int# -> Bool
isTrue# (Int#
i1 Int# -> Int# -> Int#
==# Int#
i2)
instance GEq' UWord where
  geq' :: UWord a -> UWord a -> Bool
geq' (UWord w1) (UWord w2)     = Int# -> Bool
isTrue# (Word# -> Word# -> Int#
eqWord# Word#
w1 Word#
w2)

#if !(MIN_VERSION_base(4,7,0))
isTrue# :: Bool -> Bool
isTrue# = id
#endif


class GEq a where
  geq :: a -> a -> Bool


#if __GLASGOW_HASKELL__ >= 701
  default geq :: (Generic a, GEq' (Rep a)) => a -> a -> Bool
  geq = a -> a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault
#endif

geqdefault :: (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault :: a -> a -> Bool
geqdefault a
x a
y = Rep a Any -> Rep a Any -> Bool
forall k (f :: k -> *) (a :: k). GEq' f => f a -> f a -> Bool
geq' (a -> Rep a Any
forall a x. Generic a => a -> Rep a x
from a
x) (a -> Rep a Any
forall a x. Generic a => a -> Rep a x
from a
y)

-- Base types instances
instance GEq () where
  geq :: () -> () -> Bool
geq = () -> () -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance (GEq a, GEq b) => GEq (a, b) where
  geq :: (a, b) -> (a, b) -> Bool
geq = (a, b) -> (a, b) -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance (GEq a, GEq b, GEq c) => GEq (a, b, c) where
  geq :: (a, b, c) -> (a, b, c) -> Bool
geq = (a, b, c) -> (a, b, c) -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance (GEq a, GEq b, GEq c, GEq d) => GEq (a, b, c, d) where
  geq :: (a, b, c, d) -> (a, b, c, d) -> Bool
geq = (a, b, c, d) -> (a, b, c, d) -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance (GEq a, GEq b, GEq c, GEq d, GEq e) => GEq (a, b, c, d, e) where
  geq :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool
geq = (a, b, c, d, e) -> (a, b, c, d, e) -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance (GEq a, GEq b, GEq c, GEq d, GEq e, GEq f)
    => GEq (a, b, c, d, e, f) where
  geq :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool
geq = (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance (GEq a, GEq b, GEq c, GEq d, GEq e, GEq f, GEq g)
    => GEq (a, b, c, d, e, f, g) where
  geq :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool
geq = (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq a => GEq [a] where
  geq :: [a] -> [a] -> Bool
geq = [a] -> [a] -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance (GEq (f p), GEq (g p)) => GEq ((f :+: g) p) where
  geq :: (:+:) f g p -> (:+:) f g p -> Bool
geq = (:+:) f g p -> (:+:) f g p -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance (GEq (f p), GEq (g p)) => GEq ((f :*: g) p) where
  geq :: (:*:) f g p -> (:*:) f g p -> Bool
geq = (:*:) f g p -> (:*:) f g p -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq (f (g p)) => GEq ((f :.: g) p) where
  geq :: (:.:) f g p -> (:.:) f g p -> Bool
geq = (:.:) f g p -> (:.:) f g p -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq All where
  geq :: All -> All -> Bool
geq = All -> All -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

#if MIN_VERSION_base(4,8,0)
instance GEq (f a) => GEq (Alt f a) where
  geq :: Alt f a -> Alt f a -> Bool
geq = Alt f a -> Alt f a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault
#endif

instance GEq Any where
  geq :: Any -> Any -> Bool
geq = Any -> Any -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

#if !(MIN_VERSION_base(4,9,0))
instance GEq Arity where
  geq = geqdefault
#endif

#if MIN_VERSION_base(4,9,0)
instance GEq a => GEq (Arg a b) where
  geq :: Arg a b -> Arg a b -> Bool
geq (Arg a
a b
_) (Arg a
b b
_) = a -> a -> Bool
forall a. GEq a => a -> a -> Bool
geq a
a a
b
#endif

instance GEq Associativity where
  geq :: Associativity -> Associativity -> Bool
geq = Associativity -> Associativity -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq Bool where
  geq :: Bool -> Bool -> Bool
geq = Bool -> Bool -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq BufferMode where
  geq :: BufferMode -> BufferMode -> Bool
geq = BufferMode -> BufferMode -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if defined(HTYPE_CC_T)
instance GEq CCc where
  geq :: CCc -> CCc -> Bool
geq = CCc -> CCc -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

instance GEq CChar where
  geq :: CChar -> CChar -> Bool
geq = CChar -> CChar -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq CClock where
  geq :: CClock -> CClock -> Bool
geq = CClock -> CClock -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if defined(HTYPE_DEV_T)
instance GEq CDev where
  geq :: CDev -> CDev -> Bool
geq = CDev -> CDev -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

instance GEq CDouble where
  geq :: CDouble -> CDouble -> Bool
geq = CDouble -> CDouble -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq CFloat where
  geq :: CFloat -> CFloat -> Bool
geq = CFloat -> CFloat -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if defined(HTYPE_GID_T)
instance GEq CGid where
  geq :: CGid -> CGid -> Bool
geq = CGid -> CGid -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

instance GEq Char where
  geq :: Char -> Char -> Bool
geq = Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if defined(HTYPE_INO_T)
instance GEq CIno where
  geq :: CIno -> CIno -> Bool
geq = CIno -> CIno -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

instance GEq CInt where
  geq :: CInt -> CInt -> Bool
geq = CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq CIntMax where
  geq :: CIntMax -> CIntMax -> Bool
geq = CIntMax -> CIntMax -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq CIntPtr where
  geq :: CIntPtr -> CIntPtr -> Bool
geq = CIntPtr -> CIntPtr -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq CLLong where
  geq :: CLLong -> CLLong -> Bool
geq = CLLong -> CLLong -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq CLong where
  geq :: CLong -> CLong -> Bool
geq = CLong -> CLong -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if defined(HTYPE_MODE_T)
instance GEq CMode where
  geq :: CMode -> CMode -> Bool
geq = CMode -> CMode -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

#if defined(HTYPE_NLINK_T)
instance GEq CNlink where
  geq :: CNlink -> CNlink -> Bool
geq = CNlink -> CNlink -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

#if defined(HTYPE_OFF_T)
instance GEq COff where
  geq :: COff -> COff -> Bool
geq = COff -> COff -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

#if MIN_VERSION_base(4,4,0)
instance GEq a => GEq (Complex a) where
  geq :: Complex a -> Complex a -> Bool
geq = Complex a -> Complex a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault
#endif

instance GEq a => GEq (Const a b) where
  geq :: Const a b -> Const a b -> Bool
geq = Const a b -> Const a b -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

#if defined(HTYPE_PID_T)
instance GEq CPid where
  geq :: CPid -> CPid -> Bool
geq = CPid -> CPid -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

instance GEq CPtrdiff where
  geq :: CPtrdiff -> CPtrdiff -> Bool
geq = CPtrdiff -> CPtrdiff -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if defined(HTYPE_RLIM_T)
instance GEq CRLim where
  geq :: CRLim -> CRLim -> Bool
geq = CRLim -> CRLim -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

instance GEq CSChar where
  geq :: CSChar -> CSChar -> Bool
geq = CSChar -> CSChar -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if defined(HTYPE_SPEED_T)
instance GEq CSpeed where
  geq :: CSpeed -> CSpeed -> Bool
geq = CSpeed -> CSpeed -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

#if MIN_VERSION_base(4,4,0)
instance GEq CSUSeconds where
  geq :: CSUSeconds -> CSUSeconds -> Bool
geq = CSUSeconds -> CSUSeconds -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

instance GEq CShort where
  geq :: CShort -> CShort -> Bool
geq = CShort -> CShort -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq CSigAtomic where
  geq :: CSigAtomic -> CSigAtomic -> Bool
geq = CSigAtomic -> CSigAtomic -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq CSize where
  geq :: CSize -> CSize -> Bool
geq = CSize -> CSize -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if defined(HTYPE_SSIZE_T)
instance GEq CSsize where
  geq :: CSsize -> CSsize -> Bool
geq = CSsize -> CSsize -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

#if defined(HTYPE_TCFLAG_T)
instance GEq CTcflag where
  geq :: CTcflag -> CTcflag -> Bool
geq = CTcflag -> CTcflag -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

instance GEq CTime where
  geq :: CTime -> CTime -> Bool
geq = CTime -> CTime -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq CUChar where
  geq :: CUChar -> CUChar -> Bool
geq = CUChar -> CUChar -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if defined(HTYPE_UID_T)
instance GEq CUid where
  geq :: CUid -> CUid -> Bool
geq = CUid -> CUid -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

instance GEq CUInt where
  geq :: CUInt -> CUInt -> Bool
geq = CUInt -> CUInt -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq CUIntMax where
  geq :: CUIntMax -> CUIntMax -> Bool
geq = CUIntMax -> CUIntMax -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq CUIntPtr where
  geq :: CUIntPtr -> CUIntPtr -> Bool
geq = CUIntPtr -> CUIntPtr -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq CULLong where
  geq :: CULLong -> CULLong -> Bool
geq = CULLong -> CULLong -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq CULong where
  geq :: CULong -> CULong -> Bool
geq = CULong -> CULong -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if MIN_VERSION_base(4,4,0)
instance GEq CUSeconds where
  geq :: CUSeconds -> CUSeconds -> Bool
geq = CUSeconds -> CUSeconds -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

instance GEq CUShort where
  geq :: CUShort -> CUShort -> Bool
geq = CUShort -> CUShort -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq CWchar where
  geq :: CWchar -> CWchar -> Bool
geq = CWchar -> CWchar -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if MIN_VERSION_base(4,9,0)
instance GEq DecidedStrictness where
  geq :: DecidedStrictness -> DecidedStrictness -> Bool
geq = DecidedStrictness -> DecidedStrictness -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault
#endif

instance GEq Double where
  geq :: Double -> Double -> Bool
geq = Double -> Double -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq a => GEq (Down a) where
  geq :: Down a -> Down a -> Bool
geq = Down a -> Down a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq a => GEq (Dual a) where
  geq :: Dual a -> Dual a -> Bool
geq = Dual a -> Dual a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance (GEq a, GEq b) => GEq (Either a b) where
  geq :: Either a b -> Either a b -> Bool
geq = Either a b -> Either a b -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq Errno where
  geq :: Errno -> Errno -> Bool
geq = Errno -> Errno -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq ExitCode where
  geq :: ExitCode -> ExitCode -> Bool
geq = ExitCode -> ExitCode -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq Fd where
  geq :: Fd -> Fd -> Bool
geq = Fd -> Fd -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq a => GEq (Monoid.First a) where
  geq :: First a -> First a -> Bool
geq = First a -> First a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

#if MIN_VERSION_base(4,9,0)
instance GEq a => GEq (Semigroup.First a) where
  geq :: First a -> First a -> Bool
geq = First a -> First a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault
#endif

instance GEq Fixity where
  geq :: Fixity -> Fixity -> Bool
geq = Fixity -> Fixity -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq Float where
  geq :: Float -> Float -> Bool
geq = Float -> Float -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq (ForeignPtr a) where
  geq :: ForeignPtr a -> ForeignPtr a -> Bool
geq = ForeignPtr a -> ForeignPtr a -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq (FunPtr a) where
  geq :: FunPtr a -> FunPtr a -> Bool
geq = FunPtr a -> FunPtr a -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq GeneralCategory where
  geq :: GeneralCategory -> GeneralCategory -> Bool
geq = GeneralCategory -> GeneralCategory -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq Handle where
  geq :: Handle -> Handle -> Bool
geq = Handle -> Handle -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq HandlePosn where
  geq :: HandlePosn -> HandlePosn -> Bool
geq = HandlePosn -> HandlePosn -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if MIN_VERSION_base(4,8,0)
instance GEq a => GEq (Identity a) where
  geq :: Identity a -> Identity a -> Bool
geq = Identity a -> Identity a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault
#endif

instance GEq Int where
  geq :: Int -> Int -> Bool
geq = Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq Int8 where
  geq :: Int8 -> Int8 -> Bool
geq = Int8 -> Int8 -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq Int16 where
  geq :: Int16 -> Int16 -> Bool
geq = Int16 -> Int16 -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq Int32 where
  geq :: Int32 -> Int32 -> Bool
geq = Int32 -> Int32 -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq Int64 where
  geq :: Int64 -> Int64 -> Bool
geq = Int64 -> Int64 -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq Integer where
  geq :: Integer -> Integer -> Bool
geq = Integer -> Integer -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq IntPtr where
  geq :: IntPtr -> IntPtr -> Bool
geq = IntPtr -> IntPtr -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq IOError where
  geq :: IOError -> IOError -> Bool
geq = IOError -> IOError -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq IOErrorType where
  geq :: IOErrorType -> IOErrorType -> Bool
geq = IOErrorType -> IOErrorType -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq IOMode where
  geq :: IOMode -> IOMode -> Bool
geq = IOMode -> IOMode -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq c => GEq (K1 i c p) where
  geq :: K1 i c p -> K1 i c p -> Bool
geq = K1 i c p -> K1 i c p -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq a => GEq (Monoid.Last a) where
  geq :: Last a -> Last a -> Bool
geq = Last a -> Last a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

#if MIN_VERSION_base(4,9,0)
instance GEq a => GEq (Semigroup.Last a) where
  geq :: Last a -> Last a -> Bool
geq = Last a -> Last a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault
#endif

instance GEq (f p) => GEq (M1 i c f p) where
  geq :: M1 i c f p -> M1 i c f p -> Bool
geq = M1 i c f p -> M1 i c f p -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq a => GEq (Maybe a) where
  geq :: Maybe a -> Maybe a -> Bool
geq = Maybe a -> Maybe a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

#if MIN_VERSION_base(4,9,0)
instance GEq a => GEq (Max a) where
  geq :: Max a -> Max a -> Bool
geq = Max a -> Max a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq a => GEq (Min a) where
  geq :: Min a -> Min a -> Bool
geq = Min a -> Min a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault
#endif

#if MIN_VERSION_base(4,8,0)
instance GEq Natural where
  geq :: Natural -> Natural -> Bool
geq = Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

#if MIN_VERSION_base(4,9,0)
instance GEq a => GEq (NonEmpty a) where
  geq :: NonEmpty a -> NonEmpty a -> Bool
geq = NonEmpty a -> NonEmpty a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault
#endif

instance GEq Ordering where
  geq :: Ordering -> Ordering -> Bool
geq = Ordering -> Ordering -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq p => GEq (Par1 p) where
  geq :: Par1 p -> Par1 p -> Bool
geq = Par1 p -> Par1 p -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq a => GEq (Product a) where
  geq :: Product a -> Product a -> Bool
geq = Product a -> Product a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

#if MIN_VERSION_base(4,7,0)
instance GEq
# if MIN_VERSION_base(4,9,0)
             (Proxy s)
# else
             (Proxy (s :: *))
# endif
             where
  geq :: Proxy s -> Proxy s -> Bool
geq = Proxy s -> Proxy s -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault
#endif

instance GEq (Ptr a) where
  geq :: Ptr a -> Ptr a -> Bool
geq = Ptr a -> Ptr a -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq (f p) => GEq (Rec1 f p) where
  geq :: Rec1 f p -> Rec1 f p -> Bool
geq = Rec1 f p -> Rec1 f p -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq SeekMode where
  geq :: SeekMode -> SeekMode -> Bool
geq = SeekMode -> SeekMode -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq (StablePtr a) where
  geq :: StablePtr a -> StablePtr a -> Bool
geq = StablePtr a -> StablePtr a -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if MIN_VERSION_base(4,9,0)
instance GEq SourceStrictness where
  geq :: SourceStrictness -> SourceStrictness -> Bool
geq = SourceStrictness -> SourceStrictness -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq SourceUnpackedness where
  geq :: SourceUnpackedness -> SourceUnpackedness -> Bool
geq = SourceUnpackedness -> SourceUnpackedness -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault
#endif

instance GEq a => GEq (Sum a) where
  geq :: Sum a -> Sum a -> Bool
geq = Sum a -> Sum a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq (U1 p) where
  geq :: U1 p -> U1 p -> Bool
geq = U1 p -> U1 p -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq (UAddr p) where
  geq :: UAddr p -> UAddr p -> Bool
geq = UAddr p -> UAddr p -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq (UChar p) where
  geq :: UChar p -> UChar p -> Bool
geq = UChar p -> UChar p -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq (UDouble p) where
  geq :: UDouble p -> UDouble p -> Bool
geq = UDouble p -> UDouble p -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq (UFloat p) where
  geq :: UFloat p -> UFloat p -> Bool
geq = UFloat p -> UFloat p -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq (UInt p) where
  geq :: UInt p -> UInt p -> Bool
geq = UInt p -> UInt p -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq (UWord p) where
  geq :: UWord p -> UWord p -> Bool
geq = UWord p -> UWord p -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

instance GEq Version where
  geq :: Version -> Version -> Bool
geq = Version -> Version -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if MIN_VERSION_base(4,8,0)
instance GEq Void where
  geq :: Void -> Void -> Bool
geq = Void -> Void -> Bool
forall a. Eq a => a -> a -> Bool
(==)
#endif

instance GEq Word where
  geq :: Word -> Word -> Bool
geq = Word -> Word -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq Word8 where
  geq :: Word8 -> Word8 -> Bool
geq = Word8 -> Word8 -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq Word16 where
  geq :: Word16 -> Word16 -> Bool
geq = Word16 -> Word16 -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq Word32 where
  geq :: Word32 -> Word32 -> Bool
geq = Word32 -> Word32 -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq Word64 where
  geq :: Word64 -> Word64 -> Bool
geq = Word64 -> Word64 -> Bool
forall a. Eq a => a -> a -> Bool
(==)

instance GEq WordPtr where
  geq :: WordPtr -> WordPtr -> Bool
geq = WordPtr -> WordPtr -> Bool
forall a. Eq a => a -> a -> Bool
(==)

#if MIN_VERSION_base(4,9,0)
instance GEq m => GEq (WrappedMonoid m) where
  geq :: WrappedMonoid m -> WrappedMonoid m -> Bool
geq = WrappedMonoid m -> WrappedMonoid m -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault
#endif

instance GEq a => GEq (ZipList a) where
  geq :: ZipList a -> ZipList a -> Bool
geq = ZipList a -> ZipList a -> Bool
forall a. (Generic a, GEq' (Rep a)) => a -> a -> Bool
geqdefault

#if MIN_VERSION_base(4,10,0)
instance GEq CBool where
  geq :: CBool -> CBool -> Bool
geq = CBool -> CBool -> Bool
forall a. Eq a => a -> a -> Bool
(==)

# if defined(HTYPE_BLKSIZE_T)
instance GEq CBlkSize where
  geq :: CBlkSize -> CBlkSize -> Bool
geq = CBlkSize -> CBlkSize -> Bool
forall a. Eq a => a -> a -> Bool
(==)
# endif

# if defined(HTYPE_BLKCNT_T)
instance GEq CBlkCnt where
  geq :: CBlkCnt -> CBlkCnt -> Bool
geq = CBlkCnt -> CBlkCnt -> Bool
forall a. Eq a => a -> a -> Bool
(==)
# endif

# if defined(HTYPE_CLOCKID_T)
instance GEq CClockId where
  geq :: CClockId -> CClockId -> Bool
geq = CClockId -> CClockId -> Bool
forall a. Eq a => a -> a -> Bool
(==)
# endif

# if defined(HTYPE_FSBLKCNT_T)
instance GEq CFsBlkCnt where
  geq :: CFsBlkCnt -> CFsBlkCnt -> Bool
geq = CFsBlkCnt -> CFsBlkCnt -> Bool
forall a. Eq a => a -> a -> Bool
(==)
# endif

# if defined(HTYPE_FSFILCNT_T)
instance GEq CFsFilCnt where
  geq :: CFsFilCnt -> CFsFilCnt -> Bool
geq = CFsFilCnt -> CFsFilCnt -> Bool
forall a. Eq a => a -> a -> Bool
(==)
# endif

# if defined(HTYPE_ID_T)
instance GEq CId where
  geq :: CId -> CId -> Bool
geq = CId -> CId -> Bool
forall a. Eq a => a -> a -> Bool
(==)
# endif

# if defined(HTYPE_KEY_T)
instance GEq CKey where
  geq :: CKey -> CKey -> Bool
geq = CKey -> CKey -> Bool
forall a. Eq a => a -> a -> Bool
(==)
# endif

# if defined(HTYPE_TIMER_T)
instance GEq CTimer where
  geq :: CTimer -> CTimer -> Bool
geq = CTimer -> CTimer -> Bool
forall a. Eq a => a -> a -> Bool
(==)
# endif
#endif