iota-0.1.0.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.MultisetHash

Synopsis

Documentation

newtype MultisetHash Source #

Constructors

MultisetHash Int 

Instances

Instances details
Monoid MultisetHash Source # 
Instance details

Defined in Data.MultisetHash

Semigroup MultisetHash Source # 
Instance details

Defined in Data.MultisetHash

Num MultisetHash Source # 
Instance details

Defined in Data.MultisetHash

Show MultisetHash Source # 
Instance details

Defined in Data.MultisetHash

Eq MultisetHash Source # 
Instance details

Defined in Data.MultisetHash

Ord MultisetHash Source # 
Instance details

Defined in Data.MultisetHash

Random MultisetHash Source # 
Instance details

Defined in Data.MultisetHash

Methods

randomR :: RandomGen g => (MultisetHash, MultisetHash) -> g -> (MultisetHash, g)

random :: RandomGen g => g -> (MultisetHash, g)

randomRs :: RandomGen g => (MultisetHash, MultisetHash) -> g -> [MultisetHash]

randoms :: RandomGen g => g -> [MultisetHash]

Unbox MultisetHash Source # 
Instance details

Defined in Data.MultisetHash

Vector Vector MultisetHash Source # 
Instance details

Defined in Data.MultisetHash

Methods

basicUnsafeFreeze :: Mutable Vector s MultisetHash -> ST s (Vector MultisetHash)

basicUnsafeThaw :: Vector MultisetHash -> ST s (Mutable Vector s MultisetHash)

basicLength :: Vector MultisetHash -> Int

basicUnsafeSlice :: Int -> Int -> Vector MultisetHash -> Vector MultisetHash

basicUnsafeIndexM :: Vector MultisetHash -> Int -> Box MultisetHash

basicUnsafeCopy :: Mutable Vector s MultisetHash -> Vector MultisetHash -> ST s ()

elemseq :: Vector MultisetHash -> MultisetHash -> b -> b

MVector MVector MultisetHash Source # 
Instance details

Defined in Data.MultisetHash

Methods

basicLength :: MVector s MultisetHash -> Int

basicUnsafeSlice :: Int -> Int -> MVector s MultisetHash -> MVector s MultisetHash

basicOverlaps :: MVector s MultisetHash -> MVector s MultisetHash -> Bool

basicUnsafeNew :: Int -> ST s (MVector s MultisetHash)

basicInitialize :: MVector s MultisetHash -> ST s ()

basicUnsafeReplicate :: Int -> MultisetHash -> ST s (MVector s MultisetHash)

basicUnsafeRead :: MVector s MultisetHash -> Int -> ST s MultisetHash

basicUnsafeWrite :: MVector s MultisetHash -> Int -> MultisetHash -> ST s ()

basicClear :: MVector s MultisetHash -> ST s ()

basicSet :: MVector s MultisetHash -> MultisetHash -> ST s ()

basicUnsafeCopy :: MVector s MultisetHash -> MVector s MultisetHash -> ST s ()

basicUnsafeMove :: MVector s MultisetHash -> MVector s MultisetHash -> ST s ()

basicUnsafeGrow :: MVector s MultisetHash -> Int -> ST s (MVector s MultisetHash)

newtype Vector MultisetHash Source # 
Instance details

Defined in Data.MultisetHash

newtype Vector MultisetHash = V_MultisetHash (Vector Int)
newtype MVector s MultisetHash Source # 
Instance details

Defined in Data.MultisetHash

newtype MVector s MultisetHash = MV_MultisetHash (MVector s Int)

insertMH :: (a -> MultisetHash) -> a -> MultisetHash -> MultisetHash Source #

>>> hs = randoms (mkStdGen 123)
>>> fromListMH (hs!!) [1,2]
MultisetHash (-6020088438187520526)
>>> fromListMH (hs!!) [1,1,2]
MultisetHash (-9031158793612401624)
>>> insertMH (hs!!) 1 (fromListMH (hs!!) [1,2])
MultisetHash (-9031158793612401624)
>>> hash x = hs !! mod x 10
prop> \x xs -> fromListMH hash (x:xs) == insertMH hash x (fromListMH hash xs)
+++ OK, passed 100 tests.

deleteMH :: (a -> MultisetHash) -> a -> MultisetHash -> MultisetHash Source #

>>> hs = randoms (mkStdGen 123)
>>> fromListMH (hs!!) [1,2]
MultisetHash (-6020088438187520526)
>>> fromListMH (hs!!) [1,1,2]
MultisetHash (-9031158793612401624)
>>> deleteMH (hs!!) 1 (fromListMH (hs!!) [1,1,2])
MultisetHash (-6020088438187520526)

unionMH :: MultisetHash -> MultisetHash -> MultisetHash Source #

>>> hs = randoms (mkStdGen 123)
>>> unionMH (fromListMH (hs!!) [1,1,2]) (fromListMH (hs!!) [1,3])
MultisetHash 6625208473658164035
>>> fromListMH (hs!!) $ [1,1,2] <> [1,3]
MultisetHash 6625208473658164035

differenceMH :: MultisetHash -> MultisetHash -> MultisetHash Source #

>>> hs = randoms (mkStdGen 123)
>>> differenceMH (fromListMH (hs!!) [1,1,2]) (fromListMH (hs!!) [1,2])
MultisetHash (-3011070355424881098)
>>> fromListMH (hs!!) [1]
MultisetHash (-3011070355424881098)
>>> differenceMH (fromListMH (hs!!) [1,1,2]) (fromListMH (hs!!) [1,3])
MultisetHash (-6240781987173415667)

fromListMH :: (a -> MultisetHash) -> [a] -> MultisetHash Source #

>>> hs = randoms (mkStdGen 123)
>>> fromListMH (hs !!) [1,1,1,2,2,3]
MultisetHash 3616190390895524607
>>> fromListMH (hs !!) [1,2,1,3,1,2]
MultisetHash 3616190390895524607
>>> map (fromListMH (hs!!)) [[1],[1,1],[1,1,1]]
[MultisetHash (-3011070355424881098),MultisetHash (-6022140710849762196),MultisetHash (-9033211066274643294)]
>>> hash x = hs !! mod x 10
prop> \xs ys -> fromListMH hash (xs ++ ys) == fromListMH hash xs <> fromListMH hash ys
+++ OK, passed 100 tests.