This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
fradrive-old/test/Test/QuickCheck/Classes/Hashable.hs
2018-12-04 17:43:26 +01:00

14 lines
400 B
Haskell

module Test.QuickCheck.Classes.Hashable
( hashableLaws
) where
import ClassyPrelude
import Test.QuickCheck
import Test.QuickCheck.Classes
import Data.Proxy
hashableLaws :: forall a. (Arbitrary a, Hashable a, Eq a, Show a) => Proxy a -> Laws
hashableLaws _ = Laws "Hashable"
[ ("Injectivity", property $ \(a :: a) (a' :: a) (s :: Int) -> hashWithSalt s a /= hashWithSalt s a' ==> a /= a')
]