module Data.HashTable.IO.Swiss where import Control.Monad.ST import Data.HashTable.ST.Swiss as H import Data.Hashable (Hashable) new :: IO (Table RealWorld k v) new :: IO (Table RealWorld k v) new = ST RealWorld (Table RealWorld k v) -> IO (Table RealWorld k v) forall a. ST RealWorld a -> IO a stToIO ST RealWorld (Table RealWorld k v) forall s k v. ST s (Table s k v) H.new {-# INLINE new #-} newSized :: (Int -> IO (Table RealWorld k v)) newSized :: Int -> IO (Table RealWorld k v) newSized = ST RealWorld (Table RealWorld k v) -> IO (Table RealWorld k v) forall a. ST RealWorld a -> IO a stToIO (ST RealWorld (Table RealWorld k v) -> IO (Table RealWorld k v)) -> (Int -> ST RealWorld (Table RealWorld k v)) -> Int -> IO (Table RealWorld k v) forall b c a. (b -> c) -> (a -> b) -> a -> c . Int -> ST RealWorld (Table RealWorld k v) forall s k v. Int -> ST s (Table s k v) H.newSized {-# INLINE newSized #-} insert :: (Hashable k, Eq k) => Table RealWorld k v -> k -> v -> IO () insert :: Table RealWorld k v -> k -> v -> IO () insert Table RealWorld k v t k k = ST RealWorld () -> IO () forall a. ST RealWorld a -> IO a stToIO (ST RealWorld () -> IO ()) -> (v -> ST RealWorld ()) -> v -> IO () forall b c a. (b -> c) -> (a -> b) -> a -> c . Table RealWorld k v -> k -> v -> ST RealWorld () forall k s v. (Hashable k, Eq k) => Table s k v -> k -> v -> ST s () H.insert Table RealWorld k v t k k {-# INLINE insert #-} insert' :: (Hashable k, Eq k) => (k -> Int) -> Table RealWorld k v -> k -> v -> IO () insert' :: (k -> Int) -> Table RealWorld k v -> k -> v -> IO () insert' k -> Int h Table RealWorld k v t k k = ST RealWorld () -> IO () forall a. ST RealWorld a -> IO a stToIO (ST RealWorld () -> IO ()) -> (v -> ST RealWorld ()) -> v -> IO () forall b c a. (b -> c) -> (a -> b) -> a -> c . (k -> Int) -> Table RealWorld k v -> k -> v -> ST RealWorld () forall k s v. (Hashable k, Eq k) => (k -> Int) -> Table s k v -> k -> v -> ST s () H.insert' k -> Int h Table RealWorld k v t k k {-# INLINE insert' #-} lookup :: ((Hashable k, Show k, Eq k) => Table RealWorld k a -> k -> IO (Maybe a)) lookup :: Table RealWorld k a -> k -> IO (Maybe a) lookup Table RealWorld k a t = ST RealWorld (Maybe a) -> IO (Maybe a) forall a. ST RealWorld a -> IO a stToIO (ST RealWorld (Maybe a) -> IO (Maybe a)) -> (k -> ST RealWorld (Maybe a)) -> k -> IO (Maybe a) forall b c a. (b -> c) -> (a -> b) -> a -> c . Table RealWorld k a -> k -> ST RealWorld (Maybe a) forall k s a. (Hashable k, Eq k) => Table s k a -> k -> ST s (Maybe a) H.lookup Table RealWorld k a t {-# INLINE lookup #-} lookup' :: ((Hashable k, Show k, Eq k) => (k -> Int) -> Table RealWorld k a -> k -> IO (Maybe a)) lookup' :: (k -> Int) -> Table RealWorld k a -> k -> IO (Maybe a) lookup' k -> Int h Table RealWorld k a t = ST RealWorld (Maybe a) -> IO (Maybe a) forall a. ST RealWorld a -> IO a stToIO (ST RealWorld (Maybe a) -> IO (Maybe a)) -> (k -> ST RealWorld (Maybe a)) -> k -> IO (Maybe a) forall b c a. (b -> c) -> (a -> b) -> a -> c . (k -> Int) -> Table RealWorld k a -> k -> ST RealWorld (Maybe a) forall k s a. (Hashable k, Eq k) => (k -> Int) -> Table s k a -> k -> ST s (Maybe a) H.lookup' k -> Int h Table RealWorld k a t {-# INLINE lookup' #-} delete :: ((Hashable k, Show k, Eq k) => Table RealWorld k v -> k -> IO ()) delete :: Table RealWorld k v -> k -> IO () delete Table RealWorld k v t = ST RealWorld () -> IO () forall a. ST RealWorld a -> IO a stToIO (ST RealWorld () -> IO ()) -> (k -> ST RealWorld ()) -> k -> IO () forall b c a. (b -> c) -> (a -> b) -> a -> c . Table RealWorld k v -> k -> ST RealWorld () forall k s v. (Hashable k, Eq k) => Table s k v -> k -> ST s () H.delete Table RealWorld k v t {-# INLINE delete #-} getSize :: Table RealWorld k v -> IO Int getSize :: Table RealWorld k v -> IO Int getSize = ST RealWorld Int -> IO Int forall a. ST RealWorld a -> IO a stToIO (ST RealWorld Int -> IO Int) -> (Table RealWorld k v -> ST RealWorld Int) -> Table RealWorld k v -> IO Int forall b c a. (b -> c) -> (a -> b) -> a -> c . Table RealWorld k v -> ST RealWorld Int forall s k v. Table s k v -> ST s Int H.getSize {-# INLINE getSize #-} mutateST :: (Eq k, Hashable k) => Table RealWorld k v -> k -> (Maybe v -> ST RealWorld (Maybe v, a)) -> IO a mutateST :: Table RealWorld k v -> k -> (Maybe v -> ST RealWorld (Maybe v, a)) -> IO a mutateST Table RealWorld k v t k k = ST RealWorld a -> IO a forall a. ST RealWorld a -> IO a stToIO (ST RealWorld a -> IO a) -> ((Maybe v -> ST RealWorld (Maybe v, a)) -> ST RealWorld a) -> (Maybe v -> ST RealWorld (Maybe v, a)) -> IO a forall b c a. (b -> c) -> (a -> b) -> a -> c . Table RealWorld k v -> k -> (Maybe v -> ST RealWorld (Maybe v, a)) -> ST RealWorld a forall k s v a. (Eq k, Hashable k) => Table s k v -> k -> (Maybe v -> ST s (Maybe v, a)) -> ST s a H.mutateST Table RealWorld k v t k k {-# INLINE mutateST #-} mutate :: (Eq k, Hashable k) => Table RealWorld k v -> k -> (Maybe v -> (Maybe v, a)) -> IO a mutate :: Table RealWorld k v -> k -> (Maybe v -> (Maybe v, a)) -> IO a mutate Table RealWorld k v t k k = ST RealWorld a -> IO a forall a. ST RealWorld a -> IO a stToIO (ST RealWorld a -> IO a) -> ((Maybe v -> (Maybe v, a)) -> ST RealWorld a) -> (Maybe v -> (Maybe v, a)) -> IO a forall b c a. (b -> c) -> (a -> b) -> a -> c . Table RealWorld k v -> k -> (Maybe v -> (Maybe v, a)) -> ST RealWorld a forall k s v a. (Eq k, Hashable k) => Table s k v -> k -> (Maybe v -> (Maybe v, a)) -> ST s a H.mutate Table RealWorld k v t k k {-# INLINE mutate #-} mapM_ :: ((k, v) -> ST RealWorld a) -> Table RealWorld k v -> IO () mapM_ :: ((k, v) -> ST RealWorld a) -> Table RealWorld k v -> IO () mapM_ (k, v) -> ST RealWorld a f = ST RealWorld () -> IO () forall a. ST RealWorld a -> IO a stToIO (ST RealWorld () -> IO ()) -> (Table RealWorld k v -> ST RealWorld ()) -> Table RealWorld k v -> IO () forall b c a. (b -> c) -> (a -> b) -> a -> c . ((k, v) -> ST RealWorld a) -> Table RealWorld k v -> ST RealWorld () forall k v s a. ((k, v) -> ST s a) -> Table s k v -> ST s () H.mapM_ (k, v) -> ST RealWorld a f foldM :: (a -> (k,v) -> ST RealWorld a) -> a -> Table RealWorld k v -> IO a foldM :: (a -> (k, v) -> ST RealWorld a) -> a -> Table RealWorld k v -> IO a foldM a -> (k, v) -> ST RealWorld a f a i = ST RealWorld a -> IO a forall a. ST RealWorld a -> IO a stToIO (ST RealWorld a -> IO a) -> (Table RealWorld k v -> ST RealWorld a) -> Table RealWorld k v -> IO a forall b c a. (b -> c) -> (a -> b) -> a -> c . (a -> (k, v) -> ST RealWorld a) -> a -> Table RealWorld k v -> ST RealWorld a forall a k v s. (a -> (k, v) -> ST s a) -> a -> Table s k v -> ST s a H.foldM a -> (k, v) -> ST RealWorld a f a i