Lines Matching refs:Hashed
53 , Hashed
880 data Hashed a = Hashed a {-# UNPACK #-} !Int type
884 hashed :: Hashable a => a -> Hashed a
885 hashed a = Hashed a (hash a)
888 unhashed :: Hashed a -> a
889 unhashed (Hashed a _) = a
892 instance Eq a => Eq (Hashed a) where
893 Hashed a ha == Hashed b hb = ha == hb && a == b function
895 instance Ord a => Ord (Hashed a) where
896 Hashed a _ `compare` Hashed b _ = a `compare` b function
898 instance Show a => Show (Hashed a) where
899 showsPrec d (Hashed a _) = showParen (d > 10) $
902 instance Hashable (Hashed a) where
904 hash (Hashed _ h) = h
909 instance Hashable1 Hashed where
910 liftHashWithSalt _ s (Hashed _ h) = defaultHashWithSalt s h
912 instance (IsString a, Hashable a) => IsString (Hashed a) where
913 fromString s = let r = fromString s in Hashed r (hash r)
915 instance F.Foldable Hashed where
916 foldr f acc (Hashed a _) = f a acc
918 instance NFData a => NFData (Hashed a) where
922 mapHashed :: Hashable b => (a -> b) -> Hashed a -> Hashed b
923 mapHashed f (Hashed a _) = hashed (f a)
926 traverseHashed :: (Hashable b, Functor f) => (a -> f b) -> Hashed a -> f (Hashed b)
927 traverseHashed f (Hashed a _) = fmap hashed (f a)
932 instance Eq1 Hashed where
933 liftEq f (Hashed a ha) (Hashed b hb) = ha == hb && f a b
935 instance Ord1 Hashed where
936 liftCompare f (Hashed a _) (Hashed b _) = f a b
938 instance Show1 Hashed where
939 liftShowsPrec sp _ d (Hashed a _) = showsUnaryWith sp "hashed" d a