packages feed

IORefCAS-0.2: IORefCAS.cabal

Name:                IORefCAS
Version:             0.2
License:             BSD3
License-file:        LICENSE
Author:              Adam C. Foltzer, Ryan Newton
Maintainer:          acfoltzer@gmail.com, rrnewton@gmail.com
Category:            Data
Build-type:          Simple
Cabal-version:       >=1.8

-- Version History:
-- 0.0.1   -- initial release
-- 0.0.1.1 -- minor bump to include README
-- 0.0.1.2 -- Egad, super minor update.
-- 0.1.0.1 -- Include ptrEq in Data.CAS
-- 0.2     -- Bumped for #if policy to test for GHC >7.2.  Removed casSTRef from the API for now.

Synopsis: Atomic compare and swap for IORefs and STRefs.

Description:

  After GHC 7.2 a new `casMutVar#` primop became available, but was
  not yet exposed in Data.IORef.  This package fills that gap until
  such a time as Data.IORef obsoletes it.
 .
  Further, in addition to exposing native Haskell CAS operations, this
  package contains \"mockups\" that imititate the same functionality
  using either atomicModifyIORef and unsafe pointer equality (in
  @Data.CAS.Fake@) or using foreign functions (@Data.CAS.Foreign@).
  These alternatives are useful for debugging.
  .
  Note that the foreign option does not operate on IORefs and so is
  directly interchangeable with `Data.CAS` and `Data.CAS.Fake` only if
  the interface in `Data.CAS.Class` is used.

Extra-Source-Files:
                     Makefile, Test.hs, README.md

Library
  exposed-modules:   Data.CAS,
                     Data.CAS.Internal.Class,
                     Data.CAS.Internal.Fake,
                     Data.CAS.Internal.Foreign
  -- I have observed problems on both Mac and Linux with 7.0.x.  [2011.12.23]
  -- Thus for now we require GHC 7.2 or greater (base 4.4 or greater).
  -- Namely Test.hs observes CAS failing half the time even with only ONE thread.
  -- This is probably a tricky pointer-equality related problem.
  build-depends:     base >= 4.4.0.0 && < 5,
                     ghc-prim, bits-atomic


-- Executable 
Test-Suite test-IORefCAS
    type:       exitcode-stdio-1.0
    main-is:    Test.hs
    ghc-options: -O2 -threaded -rtsopts 
    cpp-options: -DT1 -DT2 -DT3
    build-depends: QuickCheck, HUnit, bits-atomic
-- TODO: Refactor to use test-framework:
--                 , test-framework, test-framework-hunit
-- test-framework-quickcheck2