STM +Control.Concurrent

module Control.Concurrent.STM
stm Control.Concurrent.STM
Software Transactional Memory: a modular composable concurrency abstraction. See * Composable memory transactions, by Tim Harris, Simon Marlow, Simon Peyton Jones, and Maurice Herlihy, in /ACM Conference on Principles and Practice of Parallel Programming/ 2005. http://research.microsoft.com/Users/simonpj/papers/stm/index.htm
package STMonadTrans
package
A monad transformer version of the ST monad Warning! This monad transformer should not be used with monads that can contain multiple answers, like the list monad. The reason is that the will be duplicated across the different answers and this cause Bad Things to happen (such as loss of referential transparency). Safe monads include the monads State, Reader, Writer, Maybe and combinations of their corresponding monad transformers. Version 0.3.1
package stm
package
A modular composable concurrency abstraction. Changes in version 2.4.2 * Added Control.Concurrent.STM.TSem (transactional semaphore) Changes in version 2.4.1 * Added Applicative/Alternative instances of STM for GHC <7.0 Changes in version 2.4 * Added Control.Concurrent.STM.TQueue (a faster TChan) * Added Control.Concurrent.STM.TBQueue (a bounded channel based on TQueue) * TChan has an Eq instances * Added newBroadcastTChan and newBroadcastTChanIO * Some performance improvements for TChan * Added cloneTChan Version 2.4.2
package stm-channelize
package
Turn I/O operations into STM transactions on channels. Version 0.1.1
package stm-chans
package
Additional types of channels for STM. Version 3.0.0
package stm-conduit
package
Provides two simple conduit wrappers around STM channels - a source and a sink. Version 2.1.4
package stm-delay
package
This library lets you create a one-shot timer, poll it using STM, and update it to ring at a different time than initially specified. It uses GHC event manager timeouts when available (GHC 7.2+, -threaded, non-Windows OS), yielding performance similar to threadDelay and registerDelay.  Otherwise, it falls back to forked threads and threadDelay. 0.1.1:  Add tryWaitDelayIO, improve performance for certain cases of newDelay and updateDelay, and improve example. Version 0.1.1
package stm-firehose
package
A fire hose is a component in a message passing system that let clients tap into the message flow. This module provides low level (built on STM channels) and high level (based on conduits) building blocks. It should work with a fixed amount of memory, and has non blocking write operations. Version 0.1.3
package stm-io-hooks
package
This library provides a Software Transactional Memory (STM) monad with commit and retry IO hooks. A retry-action is run (at least once) if the transaction retries, while commit-actions are executed iff the transaction commits. The AdvSTM monad also gives some atomicity guarantees for commit-actions: * When a TVar is modified in a transaction and this transaction commits, the update remains invisible to other threads until the corresponding onCommit action is run. * If the onCommit action throws an exception, the original values of the modified TVars are restored. Note: The package can be used as a drop-in replacement for Control.Concurrent.STM. This library was inspired by the AdvSTM monad on the Haskell Wiki (see http://haskell.org/haskellwiki/?title=New_monads/MonadAdvSTM). Feedback is welcome! Version 0.7.5
package stm-lifted
package
A MonadIO version of <http:hackage.haskell.orgpackagestm-2.4.2 STM> library. Version 0.1.0.0
package stm-linkedlist
package
Doubly linked lists are often used in imperative languages to maintain a collection of objects such that an object can remove itself easily.  The same idea applies here.  Thanks to STM, these lists can be shared among threads with little effort. Suppose you have a thread listening for events.  You want to dispatch events to any thread that opts in.  You could write a function that installs an event handler, performs an action, and removes the handler: > withEventHandler list handler action = > bracket (atomically $ LinkedList.append handler list) > (atomically . LinkedList.delete) > (\_ -> action) Then, you could have your listener thread dispatch events using a function like this: > dispatchEvent list event = do > handlers <- atomically $ LinkedList.toList list > forM_ handlers $ \handler -> handler event Version 0.1.0.0
package stm-orelse-io
package
While tinkering on a project, I frequently found myself wanting to wait for an IO operation unless something more important came up. The Control.Concurrent.STM.OrElseIO module is meant to reduce the boilerplate needed when choosing between IO actions and STM operations. You must use the threaded runtime with this package. TODO: * Kill off IO threads whose return values will never be needed. * Possibly rename runOrElse and friends to orElseIO or similar. Version 0.1
package stm-promise
package
Simple STM Promises for IO computations and external processes. Experimental release. Example with running the theorem prover eprover in parallel. Given this file structure: >  mul-commutative >     induction_x_0.tptp >     induction_x_1.tptp >     induction_x_y_0.tptp >     induction_x_y_1.tptp >     induction_x_y_2.tptp >     induction_x_y_3.tptp >     induction_y_0.tptp >     induction_y_1.tptp >     no_induction_0.tptp >  plus-commutative >  induction_x_0.tptp >  induction_x_1.tptp >  induction_x_y_0.tptp >  induction_x_y_1.tptp >  induction_x_y_2.tptp >  induction_x_y_3.tptp >  induction_y_0.tptp >  induction_y_1.tptp >  no_induction_0.tptp We can capture these different obligations and goals with a `Control.Concurrent.STM.Promise.Tree.Tree`. > file_tree :: Tree FilePath > file_tree = fmap (++ &quot;.tptp&quot;) $ tryAll > [ fmap (&quot;mul-commutative/&quot; ++) $ requireAny > [ fmap (&quot;induction_x_&quot; ++) $ requireAll $ map > Leaf [&quot;0&quot;,&quot;1&quot;] > , fmap (&quot;induction_y_&quot; ++) $ requireAll $ map > Leaf [&quot;0&quot;,&quot;1&quot;] > , fmap (&quot;induction_x_y_&quot; ++) $ requireAll $ map > Leaf [&quot;0&quot;,&quot;1&quot;,&quot;2&quot;,&quot;3&quot;] > , Leaf &quot;no_induction_0&quot; > ] > , fmap (&quot;plus-commutative/&quot; ++) $ requireAny > [ fmap (&quot;induction_x_&quot; ++) $ requireAll $ map > Leaf [&quot;0&quot;,&quot;1&quot;] > , fmap (&quot;induction_y_&quot; ++) $ requireAll $ map > Leaf [&quot;0&quot;,&quot;1&quot;] > , fmap (&quot;induction_x_y_&quot; ++) $ requireAll $ map > Leaf [&quot;0&quot;,&quot;1&quot;,&quot;2&quot;,&quot;3&quot;] > , Leaf &quot;no_induction_0&quot; > ] > ] A successful invocation either contains Theorem or Unsatisfiable. > success :: ProcessResult -> Bool > success r = excode r == ExitSuccess && any (`isInfixOf` stdout r) ok > where > ok = [&quot;Theorem&quot;,&quot;Unsatisfiable&quot;] Making a promise for an eprover process: > eproverPromise :: FilePath -> IO (Promise [(FilePath,Bool)]) > eproverPromise file = do > let args = [&quot;-xAuto&quot;,&quot;-tAuto&quot;,'-':&quot;-tptp3-format&quot;,&quot;-s&quot;] > promise <- processPromise &quot;eprover&quot; (file : args) &quot;&quot; > let chres :: ProcessResult -> [(FilePath,Bool)] > chres r = [ (file,success r) ] > return $ fmap chres promise Evaluate this in parallel, with a 1 second timeout for each invocation: > main :: IO () > main = do > promise_tree <- mapM eproverPromise file_tree > let timeout      = 1000 * 1000 -- microseconds > processes    = 2 > workers (Just timeout) processes (interleave promise_tree) > (_,res) <- evalTree (any (not . snd)) promise_tree > putStrLn &quot;Results: &quot; > mapM_ print res The result of this run is: > Results: > (&quot;plus-commutative/induction_x_y_0.tptp&quot;,True) > (&quot;plus-commutative/induction_x_y_1.tptp&quot;,True) > (&quot;plus-commutative/induction_x_y_2.tptp&quot;,True) > (&quot;plus-commutative/induction_x_y_3.tptp&quot;,True) This means that four out of four obligations for commutativity of plus succeeded when doing induction on both x and y. Version 0.0.2
package stm-sbchan
package
This library provides a bounded first-in first-out channel type for use in STM.  It supports a limit on the total size of items in the channel. stm-sbchan also provides a few features not found in other bounded channel libraries, such as: * Alternative overflow strategies cramSBChan and rollSBChan. cramSBChan ignores the channel's size limit, and rollSBChan removes old items from the beginning of the channel when it fills up. * The channel limit can be adjusted at runtime. Version 0.1
package stm-split
package
Transactional MVars, Vars and Channels with distinguished input and output side. When threads communicate via a TMVar, a TVar or a TChan there are often clearly defined roles, which thread is the sender and which one is receiver. We provide wrappers around the standard concurrency communication channels that make the distinction clear and type safe. For example, if a function has a parameter of type TChan.In then it is sure that it will only write to that channel. Additionally if the compiler warns about an unused TChan.Out that was created by TChan.new then you know that the receiver part of your communication is missing. See also package concurrent-split for non-transactional communication. This package follows the same idea as chan-split but is strictly Haskell 98. Version 0.0
package stm-stats
package
This module provides functions that can replace calls to atomically and count how often the transaction was retried until it succeeded. It can emit warnings when transaction are retried more often than a given threshold, and provides global statistics across all transaction. As an additional feature, if the transaction was named, transaction-related exceptions such as BlockedIndefinitelyOnSTM are replaced by variants that indicate which transaction caused the exception. Changelog: 0.2.0.0: (2011-10-10) : Added warnInSTMFunction to TrackSTMConf. : Bugfix with the global retry count warning. 0.1.0.0: (2011-10-09) : Initial Release Version 0.2.0.0
package stm-tlist
package
This package provides a mutable, singly-linked list type for use in STM. It is based on the design of Control.Concurrent.TChan, and can be used to implement a wide variety of channel types. Version 0.1.1
package stmcontrol
package
Control communication among retrying transactions Version 0.1
package ChristmasTree
package
ChristmasTree (Changing Haskell's Read Implementation Such That by Mainpulating ASTs it Reads Expressions Efficiently) is an alternative approach of read that composes grammars instead of parsers. It reads data in linear time, while the function read has an exponential behavior in some cases of data types with infix operators. Version 0.2.1.1
package DSTM
package
The DSTM package consists of the DSTM library, a name server application, and three sample distributed programs using the library. DSTM is a framework enabling the use of the STM interface, known from concurrent programming, to be used for distributed Haskell applications as well. Provided are a simple Dining Philosophers, a Chat, and a soft real-time Bomberman game application. Distributed communication is transparent to the application programmer. The application designer uses a very simple nameserver mechanism to set up the system. The DSTM library includes the management of unavailable process nodes and provides the application with abstract error information thus facilitating the implementation of robust distributed application programs. For usage please look into the included file: DSTMManual.pdf, also available at http://www.informatik.uni-kiel.de/prog/mitarbeiter/frank-kupke/. Changes from last version: * documentation available online * fixed typos in Chat example * set debug flags to no debug output Version 0.1.2

Show more results