provenience 0.1.1.0 → 0.1.2.0
raw patch · 2 files changed
+12/−2 lines, 2 files
Files
- provenience.cabal +1/−1
- src/Control/Provenience.hs +11/−1
provenience.cabal view
@@ -1,5 +1,5 @@ name: provenience-version: 0.1.1.0+version: 0.1.2.0 synopsis: Computations that automatically track data dependencies description: see README.md license: GPL-3
src/Control/Provenience.hs view
@@ -95,7 +95,8 @@ ,execProvenience ,evalProvenienceT ,evalProvenience - ,sequenceProvenienceT) where + ,sequenceProvenienceT + ,traverseProvenienceT) where import Control.Monad import Control.Monad.State.Strict -- package mtl import Control.Arrow @@ -468,6 +469,15 @@ st = VariableStore { dependencyGraph = empty, nextFreeNode = n} + +-- | Run the 'ProvenienceT' actions using a fresh pool of 'Node's, +-- collecting the results in a single 'VariableStore'. +traverseProvenienceT :: (Traversable t, Monad m) => (a -> ProvenienceT alt m b) -> + t a -> m (t b,VariableStore alt) +traverseProvenienceT f = flip runStateT st0 . traverse (fmap value . f) where + st0 = VariableStore { + dependencyGraph = empty, + nextFreeNode = 0} -- | Run multiple 'ProvenienceT' actions using the same pool of 'Node's -- but returning seperate 'VariableStore's.