{-# 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 ( Eq
, Ord
)
instance Show Fingerprint where
show :: Fingerprint -> String
show (Fingerprint w1 :: Word64
w1 w2 :: Word64
w2) = Word64 -> String
hex16 Word64
w1 String -> ShowS
forall a. [a] -> [a] -> [a]
++ Word64 -> String
hex16 Word64
w2
where
hex16 :: Word64 -> String
hex16 :: Word64 -> String
hex16 i :: Word64
i = let hex :: String
hex = Word64 -> ShowS
forall a. (Integral a, Show a) => a -> ShowS
showHex Word64
i ""
in Int -> Char -> String
forall a. Int -> a -> [a]
replicate (16 Int -> Int -> Int
forall a. Num a => a -> a -> a
- String -> Int
forall a. [a] -> Int
length String
hex) '0' String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
hex