{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude #-}
module GHC.Fingerprint.Type (Fingerprint(..)) where
import GHC.Base
import GHC.List (length, replicate)
import GHC.Num
import GHC.Show
import GHC.Word
import Numeric (showHex)
data Fingerprint = Fingerprint {-# UNPACK #-} !Word64 {-# UNPACK #-} !Word64
deriving ( Fingerprint -> Fingerprint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Fingerprint -> Fingerprint -> Bool
$c/= :: Fingerprint -> Fingerprint -> Bool
== :: Fingerprint -> Fingerprint -> Bool
$c== :: Fingerprint -> Fingerprint -> Bool
Eq
, Eq Fingerprint
Fingerprint -> Fingerprint -> Bool
Fingerprint -> Fingerprint -> Ordering
Fingerprint -> Fingerprint -> Fingerprint
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Fingerprint -> Fingerprint -> Fingerprint
$cmin :: Fingerprint -> Fingerprint -> Fingerprint
max :: Fingerprint -> Fingerprint -> Fingerprint
$cmax :: Fingerprint -> Fingerprint -> Fingerprint
>= :: Fingerprint -> Fingerprint -> Bool
$c>= :: Fingerprint -> Fingerprint -> Bool
> :: Fingerprint -> Fingerprint -> Bool
$c> :: Fingerprint -> Fingerprint -> Bool
<= :: Fingerprint -> Fingerprint -> Bool
$c<= :: Fingerprint -> Fingerprint -> Bool
< :: Fingerprint -> Fingerprint -> Bool
$c< :: Fingerprint -> Fingerprint -> Bool
compare :: Fingerprint -> Fingerprint -> Ordering
$ccompare :: Fingerprint -> Fingerprint -> Ordering
Ord
)
instance Show Fingerprint where
show :: Fingerprint -> String
show (Fingerprint Word64
w1 Word64
w2) = Word64 -> String
hex16 Word64
w1 forall a. [a] -> [a] -> [a]
++ Word64 -> String
hex16 Word64
w2
where
hex16 :: Word64 -> String
hex16 :: Word64 -> String
hex16 Word64
i = let hex :: String
hex = forall a. (Integral a, Show a) => a -> ShowS
showHex Word64
i String
""
in forall a. Int -> a -> [a]
replicate (Int
16 forall a. Num a => a -> a -> a
- forall a. [a] -> Int
length String
hex) Char
'0' forall a. [a] -> [a] -> [a]
++ String
hex