-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix build with -integer-gmp #7
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,9 @@ import GHC.Integer.GMP.Internals (BigNat(BN#)) | |
#if MIN_VERSION_base(4,8,0) | ||
import Data.Void (Void, absurd) | ||
import GHC.Natural (Natural(..)) | ||
# ifdef MIN_VERSION_integer_gmp | ||
import GHC.Exts (Word(..)) | ||
# endif | ||
#endif | ||
|
||
-- For WORD_SIZE_IN_BITS constant: | ||
|
@@ -616,7 +618,8 @@ hash32BigNatByteArrayBytes h numLimbs ba = | |
instance Hashable Natural where | ||
{-# INLINE hash #-} | ||
hash h nat = case nat of | ||
# if defined (MIN_VERSION_integer_gmp) && MIN_VERSION_integer_gmp(1,0,0) | ||
# if defined (MIN_VERSION_integer_gmp) | ||
# if MIN_VERSION_integer_gmp(1,0,0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to separate these 2 checks. Combining with if defined X && X(1,0,0) Consider the case where X is indeed not defined: if defined && (1,0,0) No you will get some error complaining about terniary operators. |
||
-- For Word-size natural | ||
(NatS# wd#) -> mixConstructor 0 $ | ||
# if WORD_SIZE_IN_BITS == 32 | ||
|
@@ -626,9 +629,13 @@ instance Hashable Natural where | |
# endif | ||
-- Else using a BigNat (which instance calls required mixConstructor): | ||
(NatJ# bn) -> hash h bn | ||
# else | ||
-- Natural represented with non-negative Integer: | ||
n -> hash h $ toInteger n | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The recommended interface to |
||
# endif | ||
# else | ||
-- Natural represented with non-negative Integer: | ||
(Natural n) -> hash h n | ||
n -> hash h $ toInteger n | ||
# endif | ||
|
||
-- This is the instance in void-0.7: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import was unused with the
integer-gmp
flag disabled.