Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for hashable 1.4.1.0 #2449

Merged
merged 1 commit into from Apr 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions clash-lib/src/Data/Primitive/ByteArray/Extra.hs
Expand Up @@ -11,7 +11,17 @@ import GHC.Exts (IsList(..))
import Control.DeepSeq (NFData(..))
#endif

#if !MIN_VERSION_hashable(1,4,2)
#if !MIN_VERSION_hashable(1,4,1)
-- Hashable <1.4.1 doesn't define hashable instances at all
#define DEFINE_HASHABLE_BYTEARRAY
#elif !MIN_VERSION_hashable(1,4,2)
-- Hashable 1.4.1 defines hashable for _some_ base versions
#if !MIN_VERSION_base(4,17,0)
#define DEFINE_HASHABLE_BYTEARRAY
#endif
#endif

#ifdef DEFINE_HASHABLE_BYTEARRAY
import Data.Hashable (Hashable(..))
#endif

Expand All @@ -24,7 +34,7 @@ instance Binary ByteArray where
get = fmap fromList get
put = put . toList

#if !MIN_VERSION_hashable(1,4,2)
#ifdef DEFINE_HASHABLE_BYTEARRAY
instance Hashable ByteArray where
hashWithSalt salt = hashWithSalt salt . toList
#endif