ivar-simple 0.3.1 → 0.3.2
raw patch · 8 files changed
+85/−68 lines, 8 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.IVar.Simple: instance Exception BlockedIndefinitelyOnIVar
- Data.IVar.Simple: instance Show BlockedIndefinitelyOnIVar
- Data.IVar.Simple: instance Typeable BlockedIndefinitelyOnIVar
+ Data.IVar.Simple: instance GHC.Classes.Eq (Data.IVar.Simple.IVar a)
+ Data.IVar.Simple: instance GHC.Exception.Exception Data.IVar.Simple.BlockedIndefinitelyOnIVar
+ Data.IVar.Simple: instance GHC.Show.Show Data.IVar.Simple.BlockedIndefinitelyOnIVar
+ Data.IVar.Simple.MIChan: instance GHC.Classes.Eq (Data.IVar.Simple.MIChan.MIChan a)
Files
- Changelog +24/−0
- HISTORY +0/−15
- LICENSE +1/−1
- README +0/−32
- README.md +29/−0
- ivar-simple.cabal +25/−20
- src/Data/IVar/Simple.hs +5/−0
- src/Data/IVar/Simple/MIChan.hs +1/−0
+ Changelog view
@@ -0,0 +1,24 @@+0.3.2 (2015-10-29)+ * add Eq instances for `IVar` and `MIChan`++0.3.1 (2015-07-02)+ * fix building with ghc 7.8++0.3 (2012-07-24)+ * change NonTermination to a custom BlockedIndefinitelyOnIVar+ exception, and require base >= 4. (using NonTermination leads to+ <<loop>> messages)++0.2 (2012-07-23)+ * change BlockedIndefinitely exception (gone since ghc 7.0) to+ NonTermination++0.1.0.2 (2009-06-03)+ * depend on base < 5 instead of base.++0.1.0.1 (2009-01-11)+ * make Data.IVar.Simple.tryWrite exception safe+ (noticed by Chris Kuklewicz)++0.1.0.0 (2009-01-11)+ * initial version
− HISTORY
@@ -1,15 +0,0 @@-0.3 (2012-07-24)- change NonTermination to a custom BlockedIndefinitelyOnIVar exception,- and require base >= 4. (using NonTermination leads to <<loop>> messages)--0.2 (2012-07-23)- change BlockedIndefinitely exception (gone since ghc 7.0) to NonTermination--0.1.0.2 (2009-06-03)- depend on base < 5 instead of base.--0.1.0.1 (2009-01-11)- make Data.IVar.Simple.tryWrite exception safe (noticed by Chris Kuklewicz)--0.1.0.0 (2009-01-11)- initial version
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2008-2012 Bertram Felgenhauer+Copyright (c) 2008-2015 Bertram Felgenhauer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
− README
@@ -1,32 +0,0 @@-What is this?----------------ivar-simple provides immutable, write-once variables (IVars) in the-Data.IVar.Simple module.--It also provides two more experimental channel implementations built on-top of IVars,-- Data.IVar.Simple.IChan:- multi-cast channels with write-once semantics.-- Data.IVar.Simple.MIChan:- channels with write semantics similar to Control.Concurrent.Chan--Comparison to data-ivar--------------------------Both data-ivar and ivar-simple provide a write-once variable. That's where-the similarities end:--- Reading an IVar with data-ivar is an IO operation. In ivar-simple it's a- pure function.-- data-ivar provides a 'Reader' monoid, monad, etc. for reading from one of- several IVars. ivar-simple has no such functionality.-- The data-ivar implementation can, in principle, add arbitrary IO actions- that are called when an IVar is written. (This detail is not exposed,- however)-- Technically, ivar-simple tries for efficiency by exploiting the existing- locking structures in the RTS; in particular, reading a full IVar for a- second time is as cheap as evaluating a record selector.- I have no performance numbers for this.
+ README.md view
@@ -0,0 +1,29 @@+## What is this?++ivar-simple provides immutable, write-once variables (`IVar`s) in the+`Data.IVar.Simple` module.++It also provides two more experimental channel implementations built on+top of `IVar`s,++* `Data.IVar.Simple.IChan`:+ multi-cast channels with write-once semantics.+* `Data.IVar.Simple.MIChan`:+ channels with write semantics similar to Control.Concurrent.Chan++## Comparison to data-ivar++Both data-ivar and ivar-simple provide a write-once variable. That's where+the similarities end:++* Reading an `IVar` with data-ivar is an `IO` operation. In ivar-simple it's+ a pure function.+* data-ivar provides a `Reader` monoid, monad, etc. for reading from one of+ several `IVar`s. ivar-simple has no such functionality.+* The data-ivar implementation can, in principle, add arbitrary `IO` actions+ that are called when an `IVar` is written. (This detail is not exposed,+ however)+* Technically, ivar-simple tries for efficiency by exploiting the existing+ locking structures in the RTS; in particular, reading a full `IVar` for+ a second time is as cheap as evaluating a record selector.+ (I have no performance numbers for this.)
ivar-simple.cabal view
@@ -1,31 +1,36 @@-Name: ivar-simple-Version: 0.3.1-Category: Concurrency-Stability: experimental-Copyright: (c) 2008-2015 Bertram Felgenhauer-Maintainer: Bertram Felgenhauer <int-e@gmx.de>-License: MIT-License-File: LICENSE-Synopsis: Write once concurrency primitives.-Description:+name: ivar-simple+version: 0.3.2+category: Concurrency+stability: experimental+copyright: (c) 2008-2015 Bertram Felgenhauer+maintainer: Bertram Felgenhauer <int-e@gmx.de>+license: MIT+license-file: LICENSE+synopsis: Write once concurrency primitives.+description: @IVar@s are write-once (immutable) variables. . They can be read, an operation that will block until a value was written to the variable. They can be written to exactly once.-Cabal-Version: >= 1.4-Build-Type: Simple-Extra-Source-Files:- README- HISTORY+cabal-version: >= 1.6+build-type: Simple+extra-source-files:+ README.md+ Changelog -Library- Hs-Source-Dirs:+source-repository head+ type: git+ location: https://github.com/int-e/ivar-simple+++library+ hs-source-dirs: src- Exposed-Modules:+ exposed-modules: Data.IVar.Simple Data.IVar.Simple.IChan Data.IVar.Simple.MIChan- Build-Depends:+ build-depends: base >= 4 && < 5- Extensions:+ extensions: DeriveDataTypeable
src/Data/IVar/Simple.hs view
@@ -37,6 +37,11 @@ -- | A write-once (/immutable/) Variable data IVar a = IVar (MVar ()) (MVar a) a +instance Eq (IVar a) where+ IVar lock1 _ _ == IVar lock2 _ _ = lock1 == lock2+ -- note: it would be possible to generalize the type to+ -- eqIVar :: IVar a -> IVar b -> Bool (but would that be useful?)+ -- | Create a new, empty 'IVar'. new :: IO (IVar a) new = do
src/Data/IVar/Simple/MIChan.hs view
@@ -29,6 +29,7 @@ -- | A multicast channel. newtype MIChan a = MIChan (MVar (IChan.IChan a))+ deriving Eq -- | Create a new multicast channel. new :: IO (MIChan a)