unamb 0.1.1 → 0.1.2
raw patch · 3 files changed
+45/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Unamb: pand :: Bool -> Bool -> Bool
+ Data.Unamb: parCommute :: (a -> a -> b) -> (a -> a -> b)
+ Data.Unamb: por :: Bool -> Bool -> Bool
Files
- src/Data/Unamb.hs +41/−4
- unamb.cabal +1/−1
- wikipage.tw +3/−0
src/Data/Unamb.hs view
@@ -10,6 +10,10 @@ -- Stability : experimental -- -- Unambiguous choice+-- +-- For non-flat types (where values may be partially defined, rather than+-- necessarily bottom or fully defined) and information merging, see the+-- '''lub''' package. ---------------------------------------------------------------------- #include "Typeable.h"@@ -18,15 +22,13 @@ ( bottom, unamb, assuming, asAgree, hang , amb, race+ -- * Some useful special applications of 'amb'+ , parCommute, por, pand ) where import Prelude hiding (catch)--- For hang--- import Control.Monad (forever) import System.IO.Unsafe --- import Data.Dynamic- import Control.Concurrent import Control.Exception (evaluate, BlockedOnDeadMVar(..), catch, throw)@@ -106,6 +108,8 @@ {- +import Data.Dynamic -- move up+ data WaitForever = WaitForever INSTANCE_TYPEABLE0(WaitForever,waitForeverTc,"WaitForever")@@ -117,3 +121,36 @@ -} ----+++{--------------------------------------------------------------------+ Some useful special applications of 'unamb'+--------------------------------------------------------------------}++-- | Turn a binary commutative operation into that tries both orders in+-- parallel. Useful when there are special cases that don't require+-- evaluating both arguments. For non-flat types and information merging,+-- see @parCommute@ in the @lub@ package.+parCommute :: (a -> a -> b) -> (a -> a -> b)+parCommute op x y = (x `op` y) `unamb` (y `op` x)++-- | Parallel or+por :: Bool -> Bool -> Bool+por = parCommute (||)++-- | Parallel and+pand :: Bool -> Bool -> Bool+pand = parCommute (&&)++{-++-- Examples:++bottom `por` True+True `por` bottom++bottom `pand` False+False `pand` bottom++-}+
unamb.cabal view
@@ -1,5 +1,5 @@ Name: unamb-Version: 0.1.1+Version: 0.1.2 Cabal-Version: >= 1.2 Synopsis: Unambiguous choice Category: Concurrency, Data, Other
wikipage.tw view
@@ -1,4 +1,5 @@ [[Category:Packages]]+[[Category:Concurrency]] == Abstract == @@ -13,3 +14,5 @@ <!-- * See the [[unamb/Versions| version history]]. --> Please leave comments at the [[Talk:unamb|Talk page]].++As of version 0.1.1, unamb requires ghc 6.10 or better.