{-# LANGUAGE CPP #-}
module GHC.Utils.Unique (sameUnique, anyOfUnique) where
#include "MachDeps.h"
import GHC.Prelude.Basic (Bool, Eq((==)), Foldable(elem))
import GHC.Types.Unique (Unique, Uniquable (getUnique))
#if WORD_SIZE_IN_BITS == 32
{-# NOINLINE sameUnique #-}
#else
{-# INLINE sameUnique #-}
#endif
sameUnique :: Uniquable a => a -> a -> Bool
sameUnique :: forall a. Uniquable a => a -> a -> Bool
sameUnique a
x a
y = a -> Unique
forall a. Uniquable a => a -> Unique
getUnique a
x Unique -> Unique -> Bool
forall a. Eq a => a -> a -> Bool
== a -> Unique
forall a. Uniquable a => a -> Unique
getUnique a
y
#if WORD_SIZE_IN_BITS == 32
{-# NOINLINE anyOfUnique #-}
#else
{-# INLINE anyOfUnique #-}
#endif
anyOfUnique :: Uniquable a => a -> [Unique] -> Bool
anyOfUnique :: forall a. Uniquable a => a -> [Unique] -> Bool
anyOfUnique a
tc [Unique]
xs = a -> Unique
forall a. Uniquable a => a -> Unique
getUnique a
tc Unique -> [Unique] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Unique]
xs