module Unison.Runtime.ANF.MurmurHash.Untyped where
import Data.ByteString.Short qualified as SBS
import Data.Digest.Murmur64
( Hash64,
Hashable64 (..),
combine,
hash64,
hash64AddInt,
)
import Data.List as List (foldl')
import Data.Map.Strict qualified as M
import Data.Map.Strict.Internal qualified as M
import Data.Text qualified as DT
import Data.Word
import Unison.ABT.Normalized (pattern TAbs, pattern TAbss)
import Unison.ConstructorReference
import Unison.ConstructorType qualified as CT
import Unison.Hash (toShort)
import Unison.Reference
import Unison.ReferentPrime
import Unison.Runtime.ANF
import Unison.Runtime.ANF.POp
import Unison.Runtime.Array qualified as PA
import Unison.Runtime.Exception
import Unison.Runtime.Foreign.Function.Type
import Unison.Runtime.Referenced
import Unison.Runtime.TypeTags (mapBinTag, mapTipTag)
import Unison.Util.Bytes qualified as B
import Unison.Util.EnumContainers qualified as EC
import Unison.Util.Text as UT hiding (reverse, pattern Text)
import Unison.Var (Var)
hash64ValueUntyped :: Referenced Value -> Hash64
hash64ValueUntyped :: Referenced Value -> Hash64
hash64ValueUntyped = UntypedValue -> Hash64
forall a. Hashable64 a => a -> Hash64
hash64 (UntypedValue -> Hash64)
-> (Referenced Value -> UntypedValue) -> Referenced Value -> Hash64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Referenced Value -> UntypedValue
UV
newtype UntypedValue = UV (Referenced Value)
instance Hashable64 UntypedValue where
hash64Add :: UntypedValue -> Hash64 -> Hash64
hash64Add = \case
UV (WithRefs [Reference]
tyrs [Reference]
tmrs Value RefNum
val) ->
HRefs RefNum -> Value RefNum -> Hash64 -> Hash64
forall r. Show r => HRefs r -> Value r -> Hash64 -> Hash64
hash64AddValue ([Reference] -> [Reference] -> HRefs RefNum
hrefIndexed [Reference]
tyrs [Reference]
tmrs) Value RefNum
val
UV (Plain Value Reference
val) ->
HRefs Reference -> Value Reference -> Hash64 -> Hash64
forall r. Show r => HRefs r -> Value r -> Hash64 -> Hash64
hash64AddValue HRefs Reference
hrefPlain Value Reference
val
data HRefs r = HRefs
{ forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTypeRef :: r -> Hash64 -> Hash64,
forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTermRef :: r -> Hash64 -> Hash64
}
hash64AddShort :: SBS.ShortByteString -> Hash64 -> Hash64
hash64AddShort :: ShortByteString -> Hash64 -> Hash64
hash64AddShort = (Hash64 -> ShortByteString -> Hash64)
-> ShortByteString -> Hash64 -> Hash64
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((Hash64 -> ShortByteString -> Hash64)
-> ShortByteString -> Hash64 -> Hash64)
-> (Hash64 -> ShortByteString -> Hash64)
-> ShortByteString
-> Hash64
-> Hash64
forall a b. (a -> b) -> a -> b
$ (Hash64 -> Word8 -> Hash64) -> Hash64 -> ShortByteString -> Hash64
forall a. (a -> Word8 -> a) -> a -> ShortByteString -> a
SBS.foldl ((Word8 -> Hash64 -> Hash64) -> Hash64 -> Word8 -> Hash64
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((Word8 -> Hash64 -> Hash64) -> Hash64 -> Word8 -> Hash64)
-> (Word8 -> Hash64 -> Hash64) -> Hash64 -> Word8 -> Hash64
forall a b. (a -> b) -> a -> b
$ Int -> Hash64 -> Hash64
hash64AddInt (Int -> Hash64 -> Hash64)
-> (Word8 -> Int) -> Word8 -> Hash64 -> Hash64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral)
hash64AddRef :: Reference -> Hash64 -> Hash64
hash64AddRef :: Reference -> Hash64 -> Hash64
hash64AddRef (ReferenceBuiltin Text
tx) Hash64
h =
(Hash64 -> Char -> Hash64) -> Hash64 -> Text -> Hash64
forall a. (a -> Char -> a) -> a -> Text -> a
DT.foldl' ((Char -> Hash64 -> Hash64) -> Hash64 -> Char -> Hash64
forall a b c. (a -> b -> c) -> b -> a -> c
flip Char -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add) (Int -> Hash64 -> Hash64
hash64AddInt Int
1 Hash64
h) Text
tx
hash64AddRef (ReferenceDerived (Id Hash
bs Pos
n)) Hash64
h =
Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Pos
n (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShortByteString -> Hash64 -> Hash64
hash64AddShort (Hash -> ShortByteString
toShort Hash
bs) (Hash64 -> Hash64) -> Hash64 -> Hash64
forall a b. (a -> b) -> a -> b
$ Int -> Hash64 -> Hash64
hash64AddInt Int
2 Hash64
h
hrefPlain :: HRefs Reference
hrefPlain :: HRefs Reference
hrefPlain = (Reference -> Hash64 -> Hash64)
-> (Reference -> Hash64 -> Hash64) -> HRefs Reference
forall r.
(r -> Hash64 -> Hash64) -> (r -> Hash64 -> Hash64) -> HRefs r
HRefs Reference -> Hash64 -> Hash64
hash64AddRef Reference -> Hash64 -> Hash64
hash64AddRef
hrefIndexed :: [Reference] -> [Reference] -> HRefs RefNum
hrefIndexed :: [Reference] -> [Reference] -> HRefs RefNum
hrefIndexed [Reference]
tyrs [Reference]
tmrs = (RefNum -> Hash64 -> Hash64)
-> (RefNum -> Hash64 -> Hash64) -> HRefs RefNum
forall r.
(r -> Hash64 -> Hash64) -> (r -> Hash64 -> Hash64) -> HRefs r
HRefs (Array (Hash64 -> Hash64) -> RefNum -> Hash64 -> Hash64
forall {a}. Array a -> RefNum -> a
ix Array (Hash64 -> Hash64)
tyhs) (Array (Hash64 -> Hash64) -> RefNum -> Hash64 -> Hash64
forall {a}. Array a -> RefNum -> a
ix Array (Hash64 -> Hash64)
tmhs)
where
tyhs :: Array (Hash64 -> Hash64)
tyhs = [Hash64 -> Hash64] -> Array (Hash64 -> Hash64)
forall a. [a] -> Array a
PA.arrayFromList ([Hash64 -> Hash64] -> Array (Hash64 -> Hash64))
-> [Hash64 -> Hash64] -> Array (Hash64 -> Hash64)
forall a b. (a -> b) -> a -> b
$ Reference -> Hash64 -> Hash64
hash64AddRef (Reference -> Hash64 -> Hash64)
-> [Reference] -> [Hash64 -> Hash64]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Reference]
tyrs
tmhs :: Array (Hash64 -> Hash64)
tmhs = [Hash64 -> Hash64] -> Array (Hash64 -> Hash64)
forall a. [a] -> Array a
PA.arrayFromList ([Hash64 -> Hash64] -> Array (Hash64 -> Hash64))
-> [Hash64 -> Hash64] -> Array (Hash64 -> Hash64)
forall a b. (a -> b) -> a -> b
$ Reference -> Hash64 -> Hash64
hash64AddRef (Reference -> Hash64 -> Hash64)
-> [Reference] -> [Hash64 -> Hash64]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Reference]
tmrs
ix :: Array a -> RefNum -> a
ix Array a
arr (RefNum Int
i) = Array a -> Int -> a
forall a. Array a -> Int -> a
PA.indexArray Array a
arr Int
i
pushCtx :: [v] -> [v] -> [v]
pushCtx :: forall v. [v] -> [v] -> [v]
pushCtx [v]
new [v]
old = [v] -> [v]
forall a. [a] -> [a]
reverse [v]
new [v] -> [v] -> [v]
forall v. [v] -> [v] -> [v]
++ [v]
old
hash64AddTermRefs :: HRefs r -> [r] -> Hash64 -> Hash64
hash64AddTermRefs :: forall r. HRefs r -> [r] -> Hash64 -> Hash64
hash64AddTermRefs HRefs r
rf = (Hash64 -> [r] -> Hash64) -> [r] -> Hash64 -> Hash64
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((Hash64 -> [r] -> Hash64) -> [r] -> Hash64 -> Hash64)
-> (Hash64 -> [r] -> Hash64) -> [r] -> Hash64 -> Hash64
forall a b. (a -> b) -> a -> b
$ (Hash64 -> r -> Hash64) -> Hash64 -> [r] -> Hash64
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' ((r -> Hash64 -> Hash64) -> Hash64 -> r -> Hash64
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((r -> Hash64 -> Hash64) -> Hash64 -> r -> Hash64)
-> (r -> Hash64 -> Hash64) -> Hash64 -> r -> Hash64
forall a b. (a -> b) -> a -> b
$ HRefs r -> r -> Hash64 -> Hash64
forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTypeRef HRefs r
rf)
hash64AddTypeRefs :: HRefs r -> [r] -> Hash64 -> Hash64
hash64AddTypeRefs :: forall r. HRefs r -> [r] -> Hash64 -> Hash64
hash64AddTypeRefs HRefs r
rf = (Hash64 -> [r] -> Hash64) -> [r] -> Hash64 -> Hash64
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((Hash64 -> [r] -> Hash64) -> [r] -> Hash64 -> Hash64)
-> (Hash64 -> [r] -> Hash64) -> [r] -> Hash64 -> Hash64
forall a b. (a -> b) -> a -> b
$ (Hash64 -> r -> Hash64) -> Hash64 -> [r] -> Hash64
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' ((r -> Hash64 -> Hash64) -> Hash64 -> r -> Hash64
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((r -> Hash64 -> Hash64) -> Hash64 -> r -> Hash64)
-> (r -> Hash64 -> Hash64) -> Hash64 -> r -> Hash64
forall a b. (a -> b) -> a -> b
$ HRefs r -> r -> Hash64 -> Hash64
forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTypeRef HRefs r
rf)
hash64AddValue :: (Show r) => HRefs r -> Value r -> Hash64 -> Hash64
hash64AddValue :: forall r. Show r => HRefs r -> Value r -> Hash64 -> Hash64
hash64AddValue HRefs r
rs = \case
Partial GroupRef r
gr ValList r
vals ->
Int -> Hash64 -> Hash64
hash64AddInt Int
1
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> GroupRef r -> Hash64 -> Hash64
forall r. HRefs r -> GroupRef r -> Hash64 -> Hash64
hash64AddGroupRef HRefs r
rs GroupRef r
gr
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> ValList r -> Hash64 -> Hash64
forall r (f :: * -> *).
(Show r, Foldable f) =>
HRefs r -> f (Value r) -> Hash64 -> Hash64
hash64AddValues HRefs r
rs ValList r
vals
Data r
_ Pos
t ValList r
vals ->
Int -> Hash64 -> Hash64
hash64AddInt Int
2
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Pos
t
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> ValList r -> Hash64 -> Hash64
forall r (f :: * -> *).
(Show r, Foldable f) =>
HRefs r -> f (Value r) -> Hash64 -> Hash64
hash64AddValues HRefs r
rs ValList r
vals
Cont ValList r
vals Cont r
k ->
Int -> Hash64 -> Hash64
hash64AddInt Int
3
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> ValList r -> Hash64 -> Hash64
forall r (f :: * -> *).
(Show r, Foldable f) =>
HRefs r -> f (Value r) -> Hash64 -> Hash64
hash64AddValues HRefs r
rs ValList r
vals
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> Cont r -> Hash64 -> Hash64
forall r. HRefs r -> Cont r -> Hash64 -> Hash64
hash64AddCont HRefs r
rs Cont r
k
BLit (Map [(Value r, Value r)]
assocs) ->
HRefs r -> Map (Value r) (Value r) -> Hash64 -> Hash64
forall r.
Show r =>
HRefs r -> Map (Value r) (Value r) -> Hash64 -> Hash64
hash64AddUMap HRefs r
rs ([(Value r, Value r)] -> Map (Value r) (Value r)
forall k a. [(k, a)] -> Map k a
M.fromDistinctAscList [(Value r, Value r)]
assocs)
BLit BLit r
lit ->
Int -> Hash64 -> Hash64
hash64AddInt Int
4 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> BLit r -> Hash64 -> Hash64
forall r. Show r => HRefs r -> BLit r -> Hash64 -> Hash64
hash64AddBLit HRefs r
rs BLit r
lit
hash64AddGroupRef :: HRefs r -> GroupRef r -> Hash64 -> Hash64
hash64AddGroupRef :: forall r. HRefs r -> GroupRef r -> Hash64 -> Hash64
hash64AddGroupRef HRefs r
rs (GR r
i Pos
k) =
HRefs r -> r -> Hash64 -> Hash64
forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTermRef HRefs r
rs r
i (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Pos
k
hash64AddValues ::
(Show r) => (Foldable f) => HRefs r -> f (Value r) -> Hash64 -> Hash64
hash64AddValues :: forall r (f :: * -> *).
(Show r, Foldable f) =>
HRefs r -> f (Value r) -> Hash64 -> Hash64
hash64AddValues HRefs r
rs f (Value r)
vs Hash64
h = (Hash64 -> Value r -> Hash64) -> Hash64 -> f (Value r) -> Hash64
forall b a. (b -> a -> b) -> b -> f a -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' ((Value r -> Hash64 -> Hash64) -> Hash64 -> Value r -> Hash64
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((Value r -> Hash64 -> Hash64) -> Hash64 -> Value r -> Hash64)
-> (Value r -> Hash64 -> Hash64) -> Hash64 -> Value r -> Hash64
forall a b. (a -> b) -> a -> b
$ HRefs r -> Value r -> Hash64 -> Hash64
forall r. Show r => HRefs r -> Value r -> Hash64 -> Hash64
hash64AddValue HRefs r
rs) Hash64
h f (Value r)
vs
hash64AddCont :: HRefs r -> Cont r -> Hash64 -> Hash64
hash64AddCont :: forall r. HRefs r -> Cont r -> Hash64 -> Hash64
hash64AddCont HRefs r
rs = \case
Cont r
KE -> Int -> Hash64 -> Hash64
hash64AddInt Int
1
Mark Pos
n [r]
_ps [(r, Value r)]
_vs Cont r
k ->
Int -> Hash64 -> Hash64
hash64AddInt Int
2
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Pos
n
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> Cont r -> Hash64 -> Hash64
forall r. HRefs r -> Cont r -> Hash64 -> Hash64
hash64AddCont HRefs r
rs Cont r
k
Push Pos
m Pos
n GroupRef r
g Cont r
k ->
Int -> Hash64 -> Hash64
hash64AddInt Int
3
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Pos
m
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Pos
n
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> GroupRef r -> Hash64 -> Hash64
forall r. HRefs r -> GroupRef r -> Hash64 -> Hash64
hash64AddGroupRef HRefs r
rs GroupRef r
g
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> Cont r -> Hash64 -> Hash64
forall r. HRefs r -> Cont r -> Hash64 -> Hash64
hash64AddCont HRefs r
rs Cont r
k
hash64AddReferent :: HRefs r -> Referent' r -> Hash64 -> Hash64
hash64AddReferent :: forall r. HRefs r -> Referent' r -> Hash64 -> Hash64
hash64AddReferent HRefs r
rs (Ref' r
i) =
Int -> Hash64 -> Hash64
hash64AddInt Int
1
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> r -> Hash64 -> Hash64
forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTermRef HRefs r
rs r
i
hash64AddReferent HRefs r
rs (Con' (ConstructorReference r
i Pos
j) ConstructorType
ct) =
Int -> Hash64 -> Hash64
hash64AddInt Int
2
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> r -> Hash64 -> Hash64
forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTypeRef HRefs r
rs r
i
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Pos
j
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Int -> Hash64 -> Hash64
hash64AddInt Int
k
where
k :: Int
k = case ConstructorType
ct of
ConstructorType
CT.Data -> Int
1
ConstructorType
CT.Effect -> Int
2
hash64AddWord8 :: Word8 -> Hash64 -> Hash64
hash64AddWord8 :: Word8 -> Hash64 -> Hash64
hash64AddWord8 = Int -> Hash64 -> Hash64
hash64AddInt (Int -> Hash64 -> Hash64)
-> (Word8 -> Int) -> Word8 -> Hash64 -> Hash64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
hash64AddByteArray :: PA.ByteArray -> Hash64 -> Hash64
hash64AddByteArray :: ByteArray -> Hash64 -> Hash64
hash64AddByteArray ByteArray
bs = Int -> Hash64 -> Hash64
go Int
0
where
sz :: Int
sz = ByteArray -> Int
PA.sizeofByteArray ByteArray
bs
go :: Int -> Hash64 -> Hash64
go Int
i !Hash64
h
| Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
sz = Hash64
h
| Word8
b <- ByteArray -> Int -> Word8
forall a. (() :: Constraint, Prim a) => ByteArray -> Int -> a
PA.indexByteArray ByteArray
bs Int
i = Int -> Hash64 -> Hash64
go (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1) (Word8 -> Hash64 -> Hash64
hash64AddWord8 Word8
b Hash64
h)
hash64AddDouble :: Double -> Hash64 -> Hash64
hash64AddDouble :: Double -> Hash64 -> Hash64
hash64AddDouble Double
d = Int -> Hash64 -> Hash64
hash64AddInt Int
i
where
i :: Int
i = ByteArray -> Int -> Int
forall a. (() :: Constraint, Prim a) => ByteArray -> Int -> a
PA.indexByteArray ([Double] -> ByteArray
forall a. Prim a => [a] -> ByteArray
PA.byteArrayFromList [Double
d]) Int
0
hash64AddBLit :: (Show r) => HRefs r -> BLit r -> Hash64 -> Hash64
hash64AddBLit :: forall r. Show r => HRefs r -> BLit r -> Hash64 -> Hash64
hash64AddBLit HRefs r
rs = \case
Text Text
tx ->
Int -> Hash64 -> Hash64
hash64AddInt Int
1 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Text -> Hash64 -> Hash64
UT.hash64AddText Text
tx
List Seq (Value r)
vs ->
Int -> Hash64 -> Hash64
hash64AddInt Int
2 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> Seq (Value r) -> Hash64 -> Hash64
forall r (f :: * -> *).
(Show r, Foldable f) =>
HRefs r -> f (Value r) -> Hash64 -> Hash64
hash64AddValues HRefs r
rs Seq (Value r)
vs
TmLink Referent' r
rn ->
Int -> Hash64 -> Hash64
hash64AddInt Int
3 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> Referent' r -> Hash64 -> Hash64
forall r. HRefs r -> Referent' r -> Hash64 -> Hash64
hash64AddReferent HRefs r
rs Referent' r
rn
TyLink r
i ->
Int -> Hash64 -> Hash64
hash64AddInt Int
4 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> r -> Hash64 -> Hash64
forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTypeRef HRefs r
rs r
i
Bytes Bytes
bs ->
Int -> Hash64 -> Hash64
hash64AddInt Int
5 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Bytes -> Hash64 -> Hash64
B.hash64AddBytes Bytes
bs
Quote Value r
v ->
Int -> Hash64 -> Hash64
hash64AddInt Int
6 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> Value r -> Hash64 -> Hash64
forall r. Show r => HRefs r -> Value r -> Hash64 -> Hash64
hash64AddValue HRefs r
rs Value r
v
Code Code r
co ->
Int -> Hash64 -> Hash64
hash64AddInt Int
7 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> Code r -> Hash64 -> Hash64
forall r. Show r => HRefs r -> Code r -> Hash64 -> Hash64
hash64AddCode HRefs r
rs Code r
co
BArr ByteArray
bs ->
Int -> Hash64 -> Hash64
hash64AddInt Int
8 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` ByteArray -> Hash64 -> Hash64
hash64AddByteArray ByteArray
bs
Arr Array (Value r)
vs ->
Int -> Hash64 -> Hash64
hash64AddInt Int
9 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> Array (Value r) -> Hash64 -> Hash64
forall r (f :: * -> *).
(Show r, Foldable f) =>
HRefs r -> f (Value r) -> Hash64 -> Hash64
hash64AddValues HRefs r
rs Array (Value r)
vs
Pos Pos
w ->
Int -> Hash64 -> Hash64
hash64AddInt Int
10 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Pos
w
Neg Pos
w ->
Int -> Hash64 -> Hash64
hash64AddInt Int
11 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Pos
w
Char Char
c ->
Int -> Hash64 -> Hash64
hash64AddInt Int
12 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Char -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Char
c
Float Double
d ->
Int -> Hash64 -> Hash64
hash64AddInt Int
13 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Double -> Hash64 -> Hash64
hash64AddDouble Double
d
Map [(Value r, Value r)]
_ ->
[Word] -> String -> Hash64 -> Hash64
forall a. HasCallStack => [Word] -> String -> a
exn [] String
"hash64AddBLit: encountered Map, should be impossible"
hash64AddCode :: (Show r) => HRefs r -> Code r -> Hash64 -> Hash64
hash64AddCode :: forall r. Show r => HRefs r -> Code r -> Hash64 -> Hash64
hash64AddCode HRefs r
rs (CodeRep SuperGroup r Symbol
sg Cacheability
_) = HRefs r -> SuperGroup r Symbol -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> SuperGroup r v -> Hash64 -> Hash64
hash64AddGroup HRefs r
rs SuperGroup r Symbol
sg
hash64AddGroup ::
(Show r) =>
(Var v) =>
HRefs r ->
SuperGroup r v ->
Hash64 ->
Hash64
hash64AddGroup :: forall r v.
(Show r, Var v) =>
HRefs r -> SuperGroup r v -> Hash64 -> Hash64
hash64AddGroup HRefs r
rs (Rec [(v, SuperNormal r v)]
bs SuperNormal r v
bd) Hash64
h =
HRefs r -> [v] -> Hash64 -> SuperNormal r v -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> Hash64 -> SuperNormal r v -> Hash64
hash64AddSuper HRefs r
rs [v]
ctx ((Hash64 -> SuperNormal r v -> Hash64)
-> Hash64 -> [SuperNormal r v] -> Hash64
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' (HRefs r -> [v] -> Hash64 -> SuperNormal r v -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> Hash64 -> SuperNormal r v -> Hash64
hash64AddSuper HRefs r
rs [v]
ctx) Hash64
h [SuperNormal r v]
cs) SuperNormal r v
bd
where
([v]
us, [SuperNormal r v]
cs) = [(v, SuperNormal r v)] -> ([v], [SuperNormal r v])
forall a b. [(a, b)] -> ([a], [b])
unzip [(v, SuperNormal r v)]
bs
ctx :: [v]
ctx = [v] -> [v]
forall a. [a] -> [a]
reverse [v]
us
hash64AddSuper ::
(Show r) =>
(Var v) =>
HRefs r ->
[v] ->
Hash64 ->
SuperNormal r v ->
Hash64
hash64AddSuper :: forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> Hash64 -> SuperNormal r v -> Hash64
hash64AddSuper HRefs r
rs [v]
ctx Hash64
h (Lambda ([Mem] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length -> Int
n) ANormal r v
bd) =
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs [v]
ctx ANormal r v
bd (Hash64 -> Hash64) -> Hash64 -> Hash64
forall a b. (a -> b) -> a -> b
$ Int -> Hash64 -> Hash64
hash64AddInt Int
n Hash64
h
hash64AddNormal ::
(Show r) => (Var v) => HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal :: forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs [v]
ctx = \case
TLets Direction Word16
_ [v]
vs ([Mem] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length -> Int
n) ANormal r v
bn ANormal r v
bd ->
Int -> Hash64 -> Hash64
hash64AddInt Int
1
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Int -> Hash64 -> Hash64
hash64AddInt Int
n
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs [v]
ctx ANormal r v
bn
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs ([v] -> [v] -> [v]
forall v. [v] -> [v] -> [v]
pushCtx [v]
vs [v]
ctx) ANormal r v
bd
TName v
v Either r v
rf [v]
as ANormal r v
bd ->
Int -> Hash64 -> Hash64
hash64AddInt Int
2
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` (r -> Hash64 -> Hash64)
-> (v -> Hash64 -> Hash64) -> Either r v -> Hash64 -> Hash64
forall a b.
(a -> Hash64 -> Hash64)
-> (b -> Hash64 -> Hash64) -> Either a b -> Hash64 -> Hash64
hash64AddEither (HRefs r -> r -> Hash64 -> Hash64
forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTermRef HRefs r
rs) ([v] -> v -> Hash64 -> Hash64
forall v. Var v => [v] -> v -> Hash64 -> Hash64
hash64AddVar [v]
ctx) Either r v
rf
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` [v] -> [v] -> Hash64 -> Hash64
forall v. Var v => [v] -> [v] -> Hash64 -> Hash64
hash64AddVars [v]
ctx [v]
as
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs ([v] -> [v] -> [v]
forall v. [v] -> [v] -> [v]
pushCtx [v
v] [v]
ctx) ANormal r v
bd
TLit Lit r
l ->
Int -> Hash64 -> Hash64
hash64AddInt Int
3
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> Lit r -> Hash64 -> Hash64
forall r. HRefs r -> Lit r -> Hash64 -> Hash64
hash64AddLit HRefs r
rs Lit r
l
TBLit Lit r
l ->
Int -> Hash64 -> Hash64
hash64AddInt Int
4
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> Lit r -> Hash64 -> Hash64
forall r. HRefs r -> Lit r -> Hash64 -> Hash64
hash64AddLit HRefs r
rs Lit r
l
TMatch v
sc Branched r (ANormal r v)
brs ->
Int -> Hash64 -> Hash64
hash64AddInt Int
5
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` [v] -> v -> Hash64 -> Hash64
forall v. Var v => [v] -> v -> Hash64 -> Hash64
hash64AddVar [v]
ctx v
sc
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> [v] -> Branched r (ANormal r v) -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> Branched r (ANormal r v) -> Hash64 -> Hash64
hash64AddBranches HRefs r
rs [v]
ctx Branched r (ANormal r v)
brs
TShift r
p v
v ANormal r v
bd ->
Int -> Hash64 -> Hash64
hash64AddInt Int
6
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> r -> Hash64 -> Hash64
forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTypeRef HRefs r
rs r
p
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs ([v] -> [v] -> [v]
forall v. [v] -> [v] -> [v]
pushCtx [v
v] [v]
ctx) ANormal r v
bd
THnd [r]
is v
hn Maybe v
ha ANormal r v
bd ->
Int -> Hash64 -> Hash64
hash64AddInt Int
7
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> [r] -> Hash64 -> Hash64
forall r. HRefs r -> [r] -> Hash64 -> Hash64
hash64AddTypeRefs HRefs r
rs [r]
is
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` [v] -> v -> Hash64 -> Hash64
forall v. Var v => [v] -> v -> Hash64 -> Hash64
hash64AddVar [v]
ctx v
hn
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` (v -> Hash64 -> Hash64) -> Maybe v -> Hash64 -> Hash64
forall a. (a -> Hash64 -> Hash64) -> Maybe a -> Hash64 -> Hash64
hash64AddMaybe ([v] -> v -> Hash64 -> Hash64
forall v. Var v => [v] -> v -> Hash64 -> Hash64
hash64AddVar [v]
ctx) Maybe v
ha
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs [v]
ctx ANormal r v
bd
TApp Func r v
fn [v]
as ->
Int -> Hash64 -> Hash64
hash64AddInt Int
8
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> [v] -> Func r v -> Hash64 -> Hash64
forall v r. Var v => HRefs r -> [v] -> Func r v -> Hash64 -> Hash64
hash64AddFunc HRefs r
rs [v]
ctx Func r v
fn
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` [v] -> [v] -> Hash64 -> Hash64
forall v. Var v => [v] -> [v] -> Hash64 -> Hash64
hash64AddVars [v]
ctx [v]
as
TFrc v
v ->
Int -> Hash64 -> Hash64
hash64AddInt Int
9
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` [v] -> v -> Hash64 -> Hash64
forall v. Var v => [v] -> v -> Hash64 -> Hash64
hash64AddVar [v]
ctx v
v
TVar v
v ->
Int -> Hash64 -> Hash64
hash64AddInt Int
10
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` [v] -> v -> Hash64 -> Hash64
forall v. Var v => [v] -> v -> Hash64 -> Hash64
hash64AddVar [v]
ctx v
v
TAbs v
v (TAbss [v]
vs ANormal r v
body) ->
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs ([v] -> [v] -> [v]
forall v. [v] -> [v] -> [v]
pushCtx (v
v v -> [v] -> [v]
forall a. a -> [a] -> [a]
: [v]
vs) [v]
ctx) ANormal r v
body
ANormal r v
v -> [Word] -> String -> Hash64 -> Hash64
forall a. HasCallStack => [Word] -> String -> a
exn [] (String
"hash64AddNormal: unsupported value: " String -> String -> String
forall v. [v] -> [v] -> [v]
++ ANormal r v -> String
forall a. Show a => a -> String
show ANormal r v
v)
hash64AddVar :: (Var v) => [v] -> v -> Hash64 -> Hash64
hash64AddVar :: forall v. Var v => [v] -> v -> Hash64 -> Hash64
hash64AddVar [v]
ctx v
v Hash64
h
| Just Int
i <- Int -> [v] -> Maybe Int
index Int
0 [v]
ctx = Int -> Hash64 -> Hash64
hash64AddInt Int
i Hash64
h
| Bool
otherwise = [Word] -> String -> Hash64
forall a. HasCallStack => [Word] -> String -> a
exn [] String
"hash64AddVar: variable not in context"
where
index :: Int -> [v] -> Maybe Int
index !Int
_ [] = Maybe Int
forall a. Maybe a
Nothing
index !Int
n (v
u : [v]
us)
| v
v v -> v -> Bool
forall a. Eq a => a -> a -> Bool
== v
u = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n
| Bool
otherwise = Int -> [v] -> Maybe Int
index (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1) [v]
us
hash64AddVars :: (Var v) => [v] -> [v] -> Hash64 -> Hash64
hash64AddVars :: forall v. Var v => [v] -> [v] -> Hash64 -> Hash64
hash64AddVars [v]
ctx = (Hash64 -> [v] -> Hash64) -> [v] -> Hash64 -> Hash64
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((Hash64 -> [v] -> Hash64) -> [v] -> Hash64 -> Hash64)
-> (Hash64 -> [v] -> Hash64) -> [v] -> Hash64 -> Hash64
forall a b. (a -> b) -> a -> b
$ (Hash64 -> v -> Hash64) -> Hash64 -> [v] -> Hash64
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' ((v -> Hash64 -> Hash64) -> Hash64 -> v -> Hash64
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((v -> Hash64 -> Hash64) -> Hash64 -> v -> Hash64)
-> (v -> Hash64 -> Hash64) -> Hash64 -> v -> Hash64
forall a b. (a -> b) -> a -> b
$ [v] -> v -> Hash64 -> Hash64
forall v. Var v => [v] -> v -> Hash64 -> Hash64
hash64AddVar [v]
ctx)
hash64AddFunc :: (Var v) => HRefs r -> [v] -> Func r v -> Hash64 -> Hash64
hash64AddFunc :: forall v r. Var v => HRefs r -> [v] -> Func r v -> Hash64 -> Hash64
hash64AddFunc HRefs r
rf [v]
ctx = \case
FVar v
v ->
Int -> Hash64 -> Hash64
hash64AddInt Int
1
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` [v] -> v -> Hash64 -> Hash64
forall v. Var v => [v] -> v -> Hash64 -> Hash64
hash64AddVar [v]
ctx v
v
FComb r
i ->
Int -> Hash64 -> Hash64
hash64AddInt Int
2
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> r -> Hash64 -> Hash64
forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTermRef HRefs r
rf r
i
FCont v
v ->
Int -> Hash64 -> Hash64
hash64AddInt Int
3
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` [v] -> v -> Hash64 -> Hash64
forall v. Var v => [v] -> v -> Hash64 -> Hash64
hash64AddVar [v]
ctx v
v
FCon r
i CTag
t ->
Int -> Hash64 -> Hash64
hash64AddInt Int
4
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> r -> Hash64 -> Hash64
forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTermRef HRefs r
rf r
i
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add (CTag -> Pos
forall t. Tag t => t -> Pos
rawTag CTag
t)
FReq r
i CTag
t ->
Int -> Hash64 -> Hash64
hash64AddInt Int
5
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> r -> Hash64 -> Hash64
forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTermRef HRefs r
rf r
i
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add (CTag -> Pos
forall t. Tag t => t -> Pos
rawTag CTag
t)
FPrim Either POp ForeignFunc
ins ->
Int -> Hash64 -> Hash64
hash64AddInt Int
6
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` (POp -> Hash64 -> Hash64)
-> (ForeignFunc -> Hash64 -> Hash64)
-> Either POp ForeignFunc
-> Hash64
-> Hash64
forall a b.
(a -> Hash64 -> Hash64)
-> (b -> Hash64 -> Hash64) -> Either a b -> Hash64 -> Hash64
hash64AddEither POp -> Hash64 -> Hash64
hash64AddPOp ForeignFunc -> Hash64 -> Hash64
hash64AddForeign Either POp ForeignFunc
ins
hash64AddLit :: HRefs r -> Lit r -> Hash64 -> Hash64
hash64AddLit :: forall r. HRefs r -> Lit r -> Hash64 -> Hash64
hash64AddLit HRefs r
rs = \case
I Int64
i -> Int -> Hash64 -> Hash64
hash64AddInt Int
1 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Int -> Hash64 -> Hash64
hash64AddInt (Int64 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int64
i)
N Pos
n -> Int -> Hash64 -> Hash64
hash64AddInt Int
2 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Pos
n
F Double
d -> Int -> Hash64 -> Hash64
hash64AddInt Int
3 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Double -> Hash64 -> Hash64
hash64AddDouble Double
d
T Text
t -> Int -> Hash64 -> Hash64
hash64AddInt Int
4 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Text -> Hash64 -> Hash64
UT.hash64AddText Text
t
C Char
c -> Int -> Hash64 -> Hash64
hash64AddInt Int
5 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Char -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Char
c
LM Referent' r
rn -> Int -> Hash64 -> Hash64
hash64AddInt Int
6 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> Referent' r -> Hash64 -> Hash64
forall r. HRefs r -> Referent' r -> Hash64 -> Hash64
hash64AddReferent HRefs r
rs Referent' r
rn
LY r
i -> Int -> Hash64 -> Hash64
hash64AddInt Int
7 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> r -> Hash64 -> Hash64
forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTypeRef HRefs r
rs r
i
hash64AddBranches ::
(Show r) =>
(Var v) =>
HRefs r ->
[v] ->
Branched r (ANormal r v) ->
Hash64 ->
Hash64
hash64AddBranches :: forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> Branched r (ANormal r v) -> Hash64 -> Hash64
hash64AddBranches HRefs r
rs [v]
ctx = \case
Branched r (ANormal r v)
MatchEmpty -> Int -> Hash64 -> Hash64
hash64AddInt Int
1
MatchIntegral EnumMap Pos (ANormal r v)
bs Maybe (ANormal r v)
df ->
Int -> Hash64 -> Hash64
hash64AddInt Int
2
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` (Pos -> ANormal r v -> Hash64 -> Hash64)
-> EnumMap Pos (ANormal r v) -> Hash64 -> Hash64
forall k v.
EnumKey k =>
(k -> v -> Hash64 -> Hash64) -> EnumMap k v -> Hash64 -> Hash64
hash64AddEMap (HRefs r -> [v] -> Pos -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> Pos -> ANormal r v -> Hash64 -> Hash64
hash64AddNAssoc HRefs r
rs [v]
ctx) EnumMap Pos (ANormal r v)
bs
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` (ANormal r v -> Hash64 -> Hash64)
-> Maybe (ANormal r v) -> Hash64 -> Hash64
forall a. (a -> Hash64 -> Hash64) -> Maybe a -> Hash64 -> Hash64
hash64AddMaybe (HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs [v]
ctx) Maybe (ANormal r v)
df
MatchText Map Text (ANormal r v)
bs Maybe (ANormal r v)
df ->
Int -> Hash64 -> Hash64
hash64AddInt Int
3
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` (Text -> ANormal r v -> Hash64 -> Hash64)
-> Map Text (ANormal r v) -> Hash64 -> Hash64
forall k v.
(k -> v -> Hash64 -> Hash64) -> Map k v -> Hash64 -> Hash64
hash64AddMap (HRefs r -> [v] -> Text -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> Text -> ANormal r v -> Hash64 -> Hash64
hash64AddTAssoc HRefs r
rs [v]
ctx) Map Text (ANormal r v)
bs
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` (ANormal r v -> Hash64 -> Hash64)
-> Maybe (ANormal r v) -> Hash64 -> Hash64
forall a. (a -> Hash64 -> Hash64) -> Maybe a -> Hash64 -> Hash64
hash64AddMaybe (HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs [v]
ctx) Maybe (ANormal r v)
df
MatchRequest [(r, EnumMap CTag ([Mem], ANormal r v))]
bs ANormal r v
pur ->
Int -> Hash64 -> Hash64
hash64AddInt Int
4
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` (r -> EnumMap CTag ([Mem], ANormal r v) -> Hash64 -> Hash64)
-> [(r, EnumMap CTag ([Mem], ANormal r v))] -> Hash64 -> Hash64
forall k v.
(k -> v -> Hash64 -> Hash64) -> [(k, v)] -> Hash64 -> Hash64
hash64AddAssocs (HRefs r
-> [v]
-> r
-> EnumMap CTag ([Mem], ANormal r v)
-> Hash64
-> Hash64
forall r v.
(Show r, Var v) =>
HRefs r
-> [v]
-> r
-> EnumMap CTag ([Mem], ANormal r v)
-> Hash64
-> Hash64
hash64AddRAssoc HRefs r
rs [v]
ctx) [(r, EnumMap CTag ([Mem], ANormal r v))]
bs
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs [v]
ctx ANormal r v
pur
MatchData r
_ EnumMap CTag ([Mem], ANormal r v)
bs Maybe (ANormal r v)
df ->
Int -> Hash64 -> Hash64
hash64AddInt Int
5
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` (CTag -> ([Mem], ANormal r v) -> Hash64 -> Hash64)
-> EnumMap CTag ([Mem], ANormal r v) -> Hash64 -> Hash64
forall k v.
EnumKey k =>
(k -> v -> Hash64 -> Hash64) -> EnumMap k v -> Hash64 -> Hash64
hash64AddEMap (HRefs r -> [v] -> CTag -> ([Mem], ANormal r v) -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> CTag -> ([Mem], ANormal r v) -> Hash64 -> Hash64
hash64AddDAssoc HRefs r
rs [v]
ctx) EnumMap CTag ([Mem], ANormal r v)
bs
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` (ANormal r v -> Hash64 -> Hash64)
-> Maybe (ANormal r v) -> Hash64 -> Hash64
forall a. (a -> Hash64 -> Hash64) -> Maybe a -> Hash64 -> Hash64
hash64AddMaybe (HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs [v]
ctx) Maybe (ANormal r v)
df
MatchSum EnumMap Pos ([Mem], ANormal r v)
bs ->
Int -> Hash64 -> Hash64
hash64AddInt Int
6
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` (Pos -> ([Mem], ANormal r v) -> Hash64 -> Hash64)
-> EnumMap Pos ([Mem], ANormal r v) -> Hash64 -> Hash64
forall k v.
EnumKey k =>
(k -> v -> Hash64 -> Hash64) -> EnumMap k v -> Hash64 -> Hash64
hash64AddEMap (HRefs r -> [v] -> Pos -> ([Mem], ANormal r v) -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> Pos -> ([Mem], ANormal r v) -> Hash64 -> Hash64
hash64AddSAssoc HRefs r
rs [v]
ctx) EnumMap Pos ([Mem], ANormal r v)
bs
MatchNumeric r
_ EnumMap Pos (ANormal r v)
bs Maybe (ANormal r v)
df ->
Int -> Hash64 -> Hash64
hash64AddInt Int
7
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` (Pos -> ANormal r v -> Hash64 -> Hash64)
-> EnumMap Pos (ANormal r v) -> Hash64 -> Hash64
forall k v.
EnumKey k =>
(k -> v -> Hash64 -> Hash64) -> EnumMap k v -> Hash64 -> Hash64
hash64AddEMap (HRefs r -> [v] -> Pos -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> Pos -> ANormal r v -> Hash64 -> Hash64
hash64AddNAssoc HRefs r
rs [v]
ctx) EnumMap Pos (ANormal r v)
bs
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` (ANormal r v -> Hash64 -> Hash64)
-> Maybe (ANormal r v) -> Hash64 -> Hash64
forall a. (a -> Hash64 -> Hash64) -> Maybe a -> Hash64 -> Hash64
hash64AddMaybe (HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs [v]
ctx) Maybe (ANormal r v)
df
hash64AddNAssoc ::
(Show r) =>
(Var v) =>
HRefs r ->
[v] ->
Word64 ->
ANormal r v ->
Hash64 ->
Hash64
hash64AddNAssoc :: forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> Pos -> ANormal r v -> Hash64 -> Hash64
hash64AddNAssoc HRefs r
rs [v]
ctx Pos
n ANormal r v
tm =
Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Pos
n (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs [v]
ctx ANormal r v
tm
hash64AddTAssoc ::
(Show r) =>
(Var v) =>
HRefs r ->
[v] ->
UT.Text ->
ANormal r v ->
Hash64 ->
Hash64
hash64AddTAssoc :: forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> Text -> ANormal r v -> Hash64 -> Hash64
hash64AddTAssoc HRefs r
rs [v]
ctx Text
t ANormal r v
tm =
Text -> Hash64 -> Hash64
UT.hash64AddText Text
t (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs [v]
ctx ANormal r v
tm
hash64AddDAssoc ::
(Show r) =>
(Var v) =>
HRefs r ->
[v] ->
CTag ->
([Mem], ANormal r v) ->
Hash64 ->
Hash64
hash64AddDAssoc :: forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> CTag -> ([Mem], ANormal r v) -> Hash64 -> Hash64
hash64AddDAssoc HRefs r
rs [v]
ctx (CTag -> Pos
forall t. Tag t => t -> Pos
rawTag -> Pos
t) ([Mem] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length -> Int
n, ANormal r v
tm) =
Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Pos
t
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Int -> Hash64 -> Hash64
hash64AddInt Int
n
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs [v]
ctx ANormal r v
tm
hash64AddSAssoc ::
(Show r) => (Var v) => HRefs r -> [v] -> Word64 -> ([Mem], ANormal r v) -> Hash64 -> Hash64
hash64AddSAssoc :: forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> Pos -> ([Mem], ANormal r v) -> Hash64 -> Hash64
hash64AddSAssoc HRefs r
rs [v]
ctx Pos
t ([Mem] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length -> Int
n, ANormal r v
tm) =
Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add Pos
t
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Int -> Hash64 -> Hash64
hash64AddInt Int
n
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs [v]
ctx ANormal r v
tm
hash64AddRAssoc ::
(Show r) => (Var v) => HRefs r -> [v] -> r -> EC.EnumMap CTag ([Mem], ANormal r v) -> Hash64 -> Hash64
hash64AddRAssoc :: forall r v.
(Show r, Var v) =>
HRefs r
-> [v]
-> r
-> EnumMap CTag ([Mem], ANormal r v)
-> Hash64
-> Hash64
hash64AddRAssoc HRefs r
rs [v]
ctx r
i EnumMap CTag ([Mem], ANormal r v)
bs =
HRefs r -> r -> Hash64 -> Hash64
forall r. HRefs r -> r -> Hash64 -> Hash64
hash64AddTypeRef HRefs r
rs r
i
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` (CTag -> ([Mem], ANormal r v) -> Hash64 -> Hash64)
-> EnumMap CTag ([Mem], ANormal r v) -> Hash64 -> Hash64
forall k v.
EnumKey k =>
(k -> v -> Hash64 -> Hash64) -> EnumMap k v -> Hash64 -> Hash64
hash64AddEMap CTag -> ([Mem], ANormal r v) -> Hash64 -> Hash64
addInner EnumMap CTag ([Mem], ANormal r v)
bs
where
addInner :: CTag -> ([Mem], ANormal r v) -> Hash64 -> Hash64
addInner CTag
t ([Mem] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length -> Int
n, ANormal r v
tm) =
Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add (CTag -> Pos
forall t. Tag t => t -> Pos
rawTag CTag
t)
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` Int -> Hash64 -> Hash64
hash64AddInt Int
n
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
forall r v.
(Show r, Var v) =>
HRefs r -> [v] -> ANormal r v -> Hash64 -> Hash64
hash64AddNormal HRefs r
rs [v]
ctx ANormal r v
tm
hash64AddPOp :: POp -> Hash64 -> Hash64
hash64AddPOp :: POp -> Hash64 -> Hash64
hash64AddPOp POp
p = Int -> Hash64 -> Hash64
hash64AddInt (Int -> Hash64 -> Hash64)
-> (Word16 -> Int) -> Word16 -> Hash64 -> Hash64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word16 -> Hash64 -> Hash64) -> Word16 -> Hash64 -> Hash64
forall a b. (a -> b) -> a -> b
$ POp -> Word16
pOpCode POp
p
hash64AddForeign :: ForeignFunc -> Hash64 -> Hash64
hash64AddForeign :: ForeignFunc -> Hash64 -> Hash64
hash64AddForeign ForeignFunc
_f = Hash64 -> Hash64
forall a. a -> a
id
hash64AddEither ::
(a -> Hash64 -> Hash64) ->
(b -> Hash64 -> Hash64) ->
Either a b ->
Hash64 ->
Hash64
hash64AddEither :: forall a b.
(a -> Hash64 -> Hash64)
-> (b -> Hash64 -> Hash64) -> Either a b -> Hash64 -> Hash64
hash64AddEither a -> Hash64 -> Hash64
l b -> Hash64 -> Hash64
r = \case
Left a
x -> a -> Hash64 -> Hash64
l a
x (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Hash64 -> Hash64
hash64AddInt Int
1
Right b
y -> b -> Hash64 -> Hash64
r b
y (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Hash64 -> Hash64
hash64AddInt Int
2
hash64AddMaybe :: (a -> Hash64 -> Hash64) -> Maybe a -> Hash64 -> Hash64
hash64AddMaybe :: forall a. (a -> Hash64 -> Hash64) -> Maybe a -> Hash64 -> Hash64
hash64AddMaybe a -> Hash64 -> Hash64
h = \case
Maybe a
Nothing -> Int -> Hash64 -> Hash64
hash64AddInt Int
1
Just a
x -> Int -> Hash64 -> Hash64
hash64AddInt Int
2 (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
`combine` a -> Hash64 -> Hash64
h a
x
rot :: (a -> b -> c -> d) -> c -> a -> b -> d
rot :: forall a b c d. (a -> b -> c -> d) -> c -> a -> b -> d
rot a -> b -> c -> d
f c
z a
x b
y = a -> b -> c -> d
f a
x b
y c
z
hash64AddAssocs ::
(k -> v -> Hash64 -> Hash64) -> [(k, v)] -> Hash64 -> Hash64
hash64AddAssocs :: forall k v.
(k -> v -> Hash64 -> Hash64) -> [(k, v)] -> Hash64 -> Hash64
hash64AddAssocs k -> v -> Hash64 -> Hash64
f = (Hash64 -> [(k, v)] -> Hash64) -> [(k, v)] -> Hash64 -> Hash64
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((Hash64 -> [(k, v)] -> Hash64) -> [(k, v)] -> Hash64 -> Hash64)
-> (Hash64 -> [(k, v)] -> Hash64) -> [(k, v)] -> Hash64 -> Hash64
forall a b. (a -> b) -> a -> b
$ (Hash64 -> (k, v) -> Hash64) -> Hash64 -> [(k, v)] -> Hash64
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' (((k, v) -> Hash64 -> Hash64) -> Hash64 -> (k, v) -> Hash64
forall a b c. (a -> b -> c) -> b -> a -> c
flip (((k, v) -> Hash64 -> Hash64) -> Hash64 -> (k, v) -> Hash64)
-> ((k, v) -> Hash64 -> Hash64) -> Hash64 -> (k, v) -> Hash64
forall a b. (a -> b) -> a -> b
$ (k -> v -> Hash64 -> Hash64) -> (k, v) -> Hash64 -> Hash64
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry k -> v -> Hash64 -> Hash64
f)
hash64AddEMap ::
(EC.EnumKey k) =>
(k -> v -> Hash64 -> Hash64) ->
EC.EnumMap k v ->
Hash64 ->
Hash64
hash64AddEMap :: forall k v.
EnumKey k =>
(k -> v -> Hash64 -> Hash64) -> EnumMap k v -> Hash64 -> Hash64
hash64AddEMap k -> v -> Hash64 -> Hash64
f = (Hash64 -> EnumMap k v -> Hash64)
-> EnumMap k v -> Hash64 -> Hash64
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((Hash64 -> EnumMap k v -> Hash64)
-> EnumMap k v -> Hash64 -> Hash64)
-> (Hash64 -> EnumMap k v -> Hash64)
-> EnumMap k v
-> Hash64
-> Hash64
forall a b. (a -> b) -> a -> b
$ (Hash64 -> k -> v -> Hash64) -> Hash64 -> EnumMap k v -> Hash64
forall k r a.
EnumKey k =>
(r -> k -> a -> r) -> r -> EnumMap k a -> r
EC.foldlWithKey ((k -> v -> Hash64 -> Hash64) -> Hash64 -> k -> v -> Hash64
forall a b c d. (a -> b -> c -> d) -> c -> a -> b -> d
rot k -> v -> Hash64 -> Hash64
f)
hash64AddMap ::
(k -> v -> Hash64 -> Hash64) -> M.Map k v -> Hash64 -> Hash64
hash64AddMap :: forall k v.
(k -> v -> Hash64 -> Hash64) -> Map k v -> Hash64 -> Hash64
hash64AddMap k -> v -> Hash64 -> Hash64
f = (Hash64 -> Map k v -> Hash64) -> Map k v -> Hash64 -> Hash64
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((Hash64 -> Map k v -> Hash64) -> Map k v -> Hash64 -> Hash64)
-> (Hash64 -> Map k v -> Hash64) -> Map k v -> Hash64 -> Hash64
forall a b. (a -> b) -> a -> b
$ (Hash64 -> k -> v -> Hash64) -> Hash64 -> Map k v -> Hash64
forall a k b. (a -> k -> b -> a) -> a -> Map k b -> a
M.foldlWithKey' ((k -> v -> Hash64 -> Hash64) -> Hash64 -> k -> v -> Hash64
forall a b c d. (a -> b -> c -> d) -> c -> a -> b -> d
rot k -> v -> Hash64 -> Hash64
f)
hash64AddUMap ::
(Show r) => HRefs r -> M.Map (Value r) (Value r) -> Hash64 -> Hash64
hash64AddUMap :: forall r.
Show r =>
HRefs r -> Map (Value r) (Value r) -> Hash64 -> Hash64
hash64AddUMap HRefs r
rs Map (Value r) (Value r)
m Hash64
h = case Map (Value r) (Value r)
m of
Map (Value r) (Value r)
M.Tip ->
Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add (PackedTag -> Pos
maskTags PackedTag
mapTipTag) (Hash64 -> Hash64) -> Hash64 -> Hash64
forall a b. (a -> b) -> a -> b
$
Int -> Hash64 -> Hash64
hash64AddInt Int
2 Hash64
h
M.Bin Int
sz Value r
k Value r
v Map (Value r) (Value r)
l Map (Value r) (Value r)
r ->
HRefs r -> Map (Value r) (Value r) -> Hash64 -> Hash64
forall r.
Show r =>
HRefs r -> Map (Value r) (Value r) -> Hash64 -> Hash64
hash64AddUMap HRefs r
rs Map (Value r) (Value r)
r
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HRefs r -> Map (Value r) (Value r) -> Hash64 -> Hash64
forall r.
Show r =>
HRefs r -> Map (Value r) (Value r) -> Hash64 -> Hash64
hash64AddUMap HRefs r
rs Map (Value r) (Value r)
l
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HRefs r -> Value r -> Hash64 -> Hash64
forall r. Show r => HRefs r -> Value r -> Hash64 -> Hash64
hash64AddValue HRefs r
rs Value r
v
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HRefs r -> Value r -> Hash64 -> Hash64
forall r. Show r => HRefs r -> Value r -> Hash64 -> Hash64
hash64AddValue HRefs r
rs Value r
k
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Hash64 -> Hash64
hash64AddInt Int
sz
(Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Pos -> Hash64 -> Hash64
forall a. Hashable64 a => a -> Hash64 -> Hash64
hash64Add (PackedTag -> Pos
maskTags PackedTag
mapBinTag)
(Hash64 -> Hash64) -> Hash64 -> Hash64
forall a b. (a -> b) -> a -> b
$ Int -> Hash64 -> Hash64
hash64AddInt Int
2 Hash64
h
hash64AddAssoc ::
(Hashable64 k) =>
(k -> Hash64 -> Hash64) ->
(v -> Hash64 -> Hash64) ->
(k -> v -> Hash64 -> Hash64)
hash64AddAssoc :: forall k v.
Hashable64 k =>
(k -> Hash64 -> Hash64)
-> (v -> Hash64 -> Hash64) -> k -> v -> Hash64 -> Hash64
hash64AddAssoc k -> Hash64 -> Hash64
f v -> Hash64 -> Hash64
g k
k v
v = v -> Hash64 -> Hash64
g v
v (Hash64 -> Hash64) -> (Hash64 -> Hash64) -> Hash64 -> Hash64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. k -> Hash64 -> Hash64
f k
k