abstract-deque 0.1.4 → 0.1.5
raw patch · 3 files changed
+33/−13 lines, 3 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- Data/Concurrent/Deque/Class.hs +8/−1
- Data/Concurrent/Deque/Reference.hs +9/−5
- abstract-deque.cabal +16/−7
Data/Concurrent/Deque/Class.hs view
@@ -1,6 +1,10 @@ {-# LANGUAGE TypeFamilies, CPP, TypeSynonymInstances, MultiParamTypeClasses,- FlexibleInstances, EmptyDataDecls, DefaultSignatures #-}+ FlexibleInstances, EmptyDataDecls #-} +#ifdef DEFAULT_SIGNATURES+{-# LANGUAGE DefaultSignatures #-}+#endif+ {- | An abstract, parameterizable interface for queues. @@ -135,8 +139,11 @@ -- If bounded, the size is unspecified. newQ :: IO (d elt) +#ifdef DEFAULT_SIGNATURES+#warning "Providing default binding and signature for newQ..." default newQ :: BoundedL d => IO (d elt) newQ = newBoundedQ 256+#endif -- | Is the queue currently empty? Beware that this can be a highly transient state. nullQ :: d elt -> IO Bool
Data/Concurrent/Deque/Reference.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeFamilies, CPP #-} {-| A strawman implementation of concurrent Dequeus. This@@ -22,15 +22,19 @@ import qualified Data.Concurrent.Deque.Class as C import Data.Sequence import Data.IORef+#ifdef USE_CAS+#warning "abstract-deque: reference implementation using CAS..." import Data.CAS (atomicModifyIORefCAS)+-- Toggle these and compare performance:+modify = atomicModifyIORefCAS+#else+modify = atomicModifyIORef+#endif+{-# INLINE modify #-} -- | Stores a size bound (if any) as well as a mutable Seq. data SimpleDeque elt = DQ {-# UNPACK #-} !Int !(IORef (Seq elt)) -{-# INLINE modify #-}--- Toggle these and compare performance:--- modify = atomicModifyIORef-modify = atomicModifyIORefCAS newQ = do r <- newIORef empty return (DQ 0 r)
abstract-deque.cabal view
@@ -1,5 +1,5 @@ Name: abstract-deque-Version: 0.1.4+Version: 0.1.5 License: BSD3 License-file: LICENSE Author: Ryan R. Newton@@ -10,10 +10,11 @@ -- Version History: -- 0.1: --- 0.1.1: Added nullQ to interface.+-- 0.1.1: Added nullQ to interface. [First release] -- 0.1.2: dependency on IORefCAS -- 0.1.3: Actually turned on real CAS! DANGER--- 0.1.4: First release.+-- 0.1.4: Another release.+-- 0.1.5: Fix for 6.12 and 7.0. Synopsis: Abstract, parameterized interface to mutable Deques. @@ -43,9 +44,17 @@ Data.Concurrent.Deque.Tests, Data.Concurrent.Deque.Reference, Data.Concurrent.Deque.Reference.DequeInstance- build-depends: base >= 4.4.0.0 && < 5, - containers, HUnit, - IORefCAS >= 0.2 + build-depends: base >= 4 && < 5, + containers, HUnit++ if impl( ghc >= 7.2) {+ build-depends: IORefCAS >= 0.2 + cpp-options: -DUSE_CAS -DDEFAULT_SIGNATURES+-- extensions: DefaultSignatures+-- GHC-Options: -XDefaultSignatures+ }++ extensions: CPP ghc-options: -O2 @@ -53,5 +62,5 @@ Test-Suite test-abstract-deque type: exitcode-stdio-1.0 main-is: Test.hs- build-depends: base >= 4.4.0.0 && < 5, IORefCAS >= 0.2, containers, HUnit+ build-depends: base >= 4 && < 5, IORefCAS >= 0.2, containers, HUnit ghc-options: -O2 -threaded -rtsopts