packages feed

stm-containers 0.1.3 → 0.1.4

raw patch · 7 files changed

+60/−12 lines, 7 files

Files

library/STMContainers/Bimap.hs view
@@ -3,6 +3,7 @@   Bimap,   Association,   new,+  newIO,   insert1,   insert2,   delete1,@@ -25,7 +26,7 @@ -- A bidirectional map. -- Essentially a bijection between subsets of its two argument types. -- --- For one value of a left-hand type there this map contains one value +-- For one value of a left-hand type this map contains one value  -- of the right-hand type and vice versa. data Bimap a b =    Bimap {m1 :: !(Map.Map a b), m2 :: !(Map.Map b a)}@@ -39,6 +40,15 @@ {-# INLINABLE new #-} new :: STM (Bimap a b) new = Bimap <$> Map.new <*> Map.new++-- |+-- Construct a new bimap in IO.+-- +-- This is useful for creating it on a top-level using 'unsafePerformIO', +-- because using 'atomically' inside 'unsafePerformIO' isn't possible.+{-# INLINABLE newIO #-}+newIO :: IO (Bimap a b)+newIO = Bimap <$> Map.newIO <*> Map.newIO  -- | -- Check on being empty.
library/STMContainers/HAMT.hs view
@@ -25,6 +25,10 @@ new :: STM (HAMT e) new = Nodes.new +{-# INLINE newIO #-}+newIO :: IO (HAMT e)+newIO = Nodes.newIO+ {-# INLINE null #-} null :: HAMT e -> STM Bool null = Nodes.null
library/STMContainers/HAMT/Nodes.hs view
@@ -25,6 +25,10 @@ new :: STM (Nodes e) new = newTVar WordArray.empty +{-# INLINE newIO #-}+newIO :: IO (Nodes e)+newIO = newTVarIO WordArray.empty+ insert :: (Element e) => e -> Hash -> ElementKey e -> Level.Level -> Nodes e -> STM () insert e h k l ns = do   a <- readTVar ns
library/STMContainers/Map.hs view
@@ -3,6 +3,7 @@   Map,   Key,   new,+  newIO,   insert,   delete,   lookup,@@ -80,6 +81,15 @@ {-# INLINE new #-} new :: STM (Map k v) new = Map <$> HAMT.new++-- |+-- Construct a new map in IO.+-- +-- This is useful for creating it on a top-level using 'unsafePerformIO', +-- because using 'atomically' inside 'unsafePerformIO' isn't possible.+{-# INLINE newIO #-}+newIO :: IO (Map k v)+newIO = Map <$> HAMT.newIO  -- | -- Check, whether the map is empty.
library/STMContainers/Multimap.hs view
@@ -3,6 +3,7 @@   Multimap,   Association,   new,+  newIO,   insert,   delete,   lookup,@@ -79,7 +80,7 @@ --  -- The strategy is over a unit since we already know, -- which value we're focusing on and it doesn't make sense to replace it,--- however we still can still decide wether to keep or remove it.+-- however we still can decide wether to keep or remove it. {-# INLINE focus #-} focus :: (Association k v) => Focus.StrategyM STM () r -> v -> k -> Multimap k v -> STM r focus = @@ -123,6 +124,15 @@ {-# INLINE new #-} new :: STM (Multimap k v) new = Multimap <$> Map.new++-- |+-- Construct a new multimap in IO.+-- +-- This is useful for creating it on a top-level using 'unsafePerformIO', +-- because using 'atomically' inside 'unsafePerformIO' isn't possible.+{-# INLINE newIO #-}+newIO :: IO (Multimap k v)+newIO = Multimap <$> Map.newIO  -- | -- Check on being empty.
library/STMContainers/Set.hs view
@@ -3,6 +3,7 @@   Set,   Element,   new,+  newIO,   insert,   delete,   lookup,@@ -61,7 +62,7 @@ --  -- The strategy is over a unit since we already know,  -- which element we're focusing on and it doesn't make sense to replace it,--- however we still can still decide wether to keep or remove it.+-- however we still can decide wether to keep or remove it. {-# INLINE focus #-} focus :: (Element e) => Focus.StrategyM STM () r -> e -> Set e -> STM r focus s e = HAMT.focus elementStrategy e . hamt@@ -80,6 +81,15 @@ {-# INLINE new #-} new :: STM (Set e) new = Set <$> HAMT.new++-- |+-- Construct a new set in IO.+-- +-- This is useful for creating it on a top-level using 'unsafePerformIO', +-- because using 'atomically' inside 'unsafePerformIO' isn't possible.+{-# INLINE newIO #-}+newIO :: IO (Set e)+newIO = Set <$> HAMT.newIO  -- | -- Check, whether the set is empty.
stm-containers.cabal view
@@ -1,15 +1,19 @@ name:   stm-containers version:-  0.1.3+  0.1.4 synopsis:   Containers for STM description:-  This library is based on an STM-specialized implementation of+  This library is based on an STM-specialized implementation of a   Hash Array Mapped Trie.-  It provides very efficient implementations of @Map@ and @Set@ data structures,+  It provides efficient implementations of @Map@, @Set@ +  and other data structures,   which are slightly slower than their counterparts from \"unordered-containers\",   but scale very well on concurrent access patterns.+  .+  For details on performance of the library see+  <http://nikita-volkov.github.io/stm-containers/ this blog post>. category:   Data Structures, STM, Concurrency homepage:@@ -60,14 +64,12 @@     hashable < 1.3,     -- control:     focus > 0.1.0 && < 0.2,-    -- preludes:-    base-prelude == 0.1.*,     -- debugging:     loch-th == 0.2.*,     placeholders == 0.1.*,     -- general:     primitive == 0.5.*,-    base >= 4.5 && < 4.8+    base-prelude == 0.1.*   default-extensions:     Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFunctor, DeriveGeneric, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, ImpredicativeTypes, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples   default-language:@@ -92,14 +94,12 @@     hashable < 1.3,     -- control:     focus > 0.1.0 && < 0.2,-    -- preludes:-    base-prelude == 0.1.*,     -- debugging:     loch-th == 0.2.*,     placeholders == 0.1.*,     -- general:     primitive == 0.5.*,-    base >= 4.5 && < 4.8+    base-prelude == 0.1.*   default-extensions:     Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFunctor, DeriveGeneric, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, ImpredicativeTypes, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples   default-language: