provenience 0.1.0.2 → 0.1.1.0
raw patch · 2 files changed
+10/−2 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Provenience: (<%?>) :: Monad m => ProvenienceT alt m (a -> b) -> Either a (Variable a) -> ProvenienceT alt m b
Files
- provenience.cabal +1/−1
- src/Control/Provenience.hs +9/−1
provenience.cabal view
@@ -1,5 +1,5 @@ name: provenience-version: 0.1.0.2+version: 0.1.1.0 synopsis: Computations that automatically track data dependencies description: see README.md license: GPL-3
src/Control/Provenience.hs view
@@ -88,6 +88,7 @@ ,ProvenienceT(..) ,Provenience ,(<%>) + ,(<%?>) ,(<%%>) ,runProvenienceT ,execProvenienceT @@ -396,7 +397,7 @@ named :: Variable a -> String -> StoreUpdate v `named` name = modify' (\vs -> changeLabel (identifier v) (\desc -> desc {shortname = Just name}) vs) -infixl 4 <%>, <%%> +infixl 4 <%>, <%?>, <%%> -- | 'Applicative'-style application operator. -- Replaces the function 'Variable' with its (partial) application -- and creates an edge from the argument to the result 'Variable' @@ -429,6 +430,13 @@ -- @ (<%>) :: Monad m => ProvenienceT alt m (a -> b) -> Variable a -> ProvenienceT alt m b pf <%> x = ((fmap.fmap) (pure.) pf) <%%> x + +-- | Conditional use of a 'Variable'. +-- The @'Left' a@ could be a default parameter to the function +-- which is not worth registering a 'Variable' for. +(<%?>) :: Monad m => ProvenienceT alt m (a -> b) -> Either a (Variable a) -> ProvenienceT alt m b +pf <%?> (Right px) = pf <%> px +pf <%?> (Left x) = (fmap.fmap) ($x) pf -- | Like above but permit side-effects in the base monad. (<%%>) :: Monad m => ProvenienceT alt m (a -> m b) -> Variable a -> ProvenienceT alt m b