packages feed

monad-resumption 0.1.1.5 → 0.1.2.0

raw patch · 4 files changed

+18/−3 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Control.Monad.Resumption.Connectors: refoldT :: Monad m => (o1 -> o2) -> (o1 -> i2 -> Maybe i1) -> ReacT i1 o1 m a -> ReacT i2 o2 m a

Files

Control/Monad/Resumption.hs view
@@ -4,7 +4,6 @@ module Control.Monad.Resumption where  import Control.Monad-import Control.Monad.Trans import Control.Applicative import Control.Monad.IO.Class import Control.Monad.Morph
Control/Monad/Resumption/Connectors.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ScopedTypeVariables #-} module Control.Monad.Resumption.Connectors where  import Control.Monad.Resumption.Reactive@@ -13,6 +14,22 @@                                           (Left a,_)                        -> return $ Left a                                           (_,Left a)                        -> return $ Left a                                           (Right (o1,res1),Right (o2,res2)) -> return $ Right ((o1,o2),\(i1,i2) -> (res1 i1) <||> (res2 i2))++{- Draft implementation of refoldT -}+refoldT :: forall o1 o2 i1 i2 m a . Monad m => (o1 -> o2)+                                               -> (o1 -> i2 -> Maybe i1)+                                               -> ReacT i1 o1 m a+                                               -> ReacT i2 o2 m a+refoldT fo fi re = ReacT $ do+                             p <- deReacT re+                             case p of+                                Left a           -> return $ Left a+                                Right (o,resume) -> return $ Right (fo o, dispatch o resume)+    where+      dispatch :: o1 -> (i1 -> ReacT i1 o1 m a) -> (i2 -> ReacT i2 o2 m a)+      dispatch o1 resume = \i2 -> case fi o1 i2 of+                                        Nothing -> ReacT $ return $ Right (fo o1, dispatch o1 resume)+                                        Just x  -> refoldT fo fi (resume x)  -- | The refold operator changes the output and input types of a reactive resumption refold :: (Monad m) => (o1 -> o2) -> (o1 -> i2 -> i1) -> ReacT i1 o1 m a -> ReacT i2 o2 m a
Control/Monad/Resumption/Reactive.hs view
@@ -5,7 +5,6 @@ module Control.Monad.Resumption.Reactive where  import Control.Monad-import Control.Monad.Trans import Control.Applicative import Control.Monad.IO.Class import Control.Monad.Morph
monad-resumption.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                monad-resumption-version:             0.1.1.5+version:             0.1.2.0 synopsis:            Resumption and reactive resumption monads for Haskell. description:         This package contains the definitions of Resumption and Reactive Resumption Monads.   homepage:            https://github.com/igraves/resumption_monads