module Data.Singletons.Prelude.Eq (
PEq(..), SEq(..),
(:==$), (:==$$), (:==$$$), (:/=$), (:/=$$), (:/=$$$)
) where
import Data.Singletons.Prelude.Bool
import Data.Singletons
import Data.Singletons.Single
import Data.Singletons.Prelude.Instances
import Data.Singletons.Util
import Data.Singletons.Promote
#if __GLASGOW_HASKELL__ >= 707
import Data.Type.Equality
#endif
class kproxy ~ 'KProxy => PEq (kproxy :: KProxy a) where
type (:==) (x :: a) (y :: a) :: Bool
type (:/=) (x :: a) (y :: a) :: Bool
#if __GLASGOW_HASKELL__ < 707
type (x :: a) :== (y :: a) = Not (x :/= y)
#else
type (x :: a) :== (y :: a) = x == y
#endif
type (x :: a) :/= (y :: a) = Not (x :== y)
$(genDefunSymbols [''(:==), ''(:/=)])
class (kparam ~ 'KProxy) => SEq (kparam :: KProxy k) where
(%:==) :: forall (a :: k) (b :: k). Sing a -> Sing b -> Sing (a :== b)
(%:/=) :: forall (a :: k) (b :: k). Sing a -> Sing b -> Sing (a :/= b)
default (%:/=) :: forall (a :: k) (b :: k).
((a :/= b) ~ Not (a :== b))
=> Sing a -> Sing b -> Sing (a :/= b)
a %:/= b = sNot (a %:== b)
$(singEqInstances basicTypes)