module Games.ECS.Util.Misc where
import Data.Hashable
import Data.Sequence (Seq)
newtype HashableSeq a = HashableSeq (Seq a) deriving newtype HashableSeq a -> HashableSeq a -> Bool
(HashableSeq a -> HashableSeq a -> Bool)
-> (HashableSeq a -> HashableSeq a -> Bool) -> Eq (HashableSeq a)
forall a. Eq a => HashableSeq a -> HashableSeq a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => HashableSeq a -> HashableSeq a -> Bool
== :: HashableSeq a -> HashableSeq a -> Bool
$c/= :: forall a. Eq a => HashableSeq a -> HashableSeq a -> Bool
/= :: HashableSeq a -> HashableSeq a -> Bool
Eq
instance Hashable a => Hashable (HashableSeq a) where
{-# INLINE hashWithSalt #-}
hashWithSalt :: Int -> HashableSeq a -> Int
hashWithSalt Int
salt (HashableSeq Seq a
s) = (Int -> a -> Int) -> Int -> Seq a -> Int
forall b a. (b -> a -> b) -> b -> Seq a -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl Int -> a -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
salt Seq a
s