packages feed

mutable-containers 0.2.0 → 0.2.0.1

raw patch · 4 files changed

+13/−8 lines, 4 files

Files

Data/Mutable/PRef.hs view
@@ -18,8 +18,10 @@  import Control.Monad            (liftM) import Data.Mutable.Class-import Data.Primitive.ByteArray-import Data.Primitive.Types+import Data.Primitive           (sizeOf)+import Data.Primitive.ByteArray (MutableByteArray, newByteArray, readByteArray,+                                 writeByteArray)+import Data.Primitive.Types     (Prim) import GHC.Types                (Int (..))  -- | A primitive ByteArray reference, supporting any monad.@@ -42,7 +44,7 @@     type RefElement (PRef s a) = a      newRef x = do-        ba <- newByteArray (I# (sizeOf# x))+        ba <- newByteArray (sizeOf $! x)         writeByteArray ba 0 x         return $! PRef ba     {-# INLINE newRef #-}
README.md view
@@ -1,6 +1,9 @@+[![Coverage Status](https://img.shields.io/coveralls/fpco/mutable-containers.svg)](https://coveralls.io/r/fpco/mutable-containers)+![Travis Build Status](https://travis-ci.org/fpco/mutable-containers.svg)+ One of Haskell's strengths is immutable data structures. These structures make it easier to reason about code, simplify concurrency and parallelism, and in-some case can improve performance by allowing sharing. However, there are still+some cases can improve performance by allowing sharing. However, there are still classes of problems where mutable data structures can both be more convenient, and provide a performance boost. This library is meant to provide such structures in a performant, well tested way. It also provides a simple@@ -60,7 +63,7 @@ `mono-traversable` package works.  In addition to providing an abstraction over `IORef`, `STRef`, and `MutVar`,-this package provides four addition single-cell mutable references. `URef`,+this package provides four additional single-cell mutable references. `URef`, `SRef`, and `BRef` all contain a 1-length mutable vector under the surface, which is unboxed, storable, and boxed, respectively. The advantage of the first two over boxed standard boxed references is that it can avoid a significant@@ -73,7 +76,7 @@ actually demonstrate a performance advantage. Unlike `URef` and `SRef`, there is no restriction on the type of value it can store. -The finally reference type is `PRef`. Unlike the other three mentioned, it+The final reference type is `PRef`. Unlike the other three mentioned, it doesn't use vectors at all, but instead drops down directly to a mutable bytearray to store values. This means it has slightly less overhead (no need to store the size of the vector), but also restricts the types of things that can
mutable-containers.cabal view
@@ -1,5 +1,5 @@ name:                mutable-containers-version:             0.2.0+version:             0.2.0.1 synopsis:            Abstactions and concrete implementations of mutable containers description:         See docs and README at <http://www.stackage.org/package/mutable-containers> homepage:            https://github.com/fpco/mutable-containers
test/Spec.hs view
@@ -85,7 +85,7 @@                         expected <- readRef base                         actual <- readRef tested                         expected `shouldBe` actual-                forM_ actions $ \action -> case action of+                forM_ (actions :: [RefAction]) $ \action -> case action of                     WriteRef i -> do                         writeRef base i                         writeRef tested i