monad-resumption 0.1.0.1 → 0.1.1.0
raw patch · 2 files changed
+17/−3 lines, 2 files
Files
Control/Monad/Resumption/Reactive.hs view
@@ -1,4 +1,4 @@--- | A reactive resumption monad transforemer, based on the formulation in+-- | A reactive resumption monad transformer, based on the formulation in -- the article <http://people.cs.missouri.edu/~harrisonwl/drafts/CheapThreads.pdf Cheap (But Functional) Threads> -- by William L. Harrison and Adam Procter. module Control.Monad.Resumption.Reactive where@@ -50,3 +50,13 @@ case r2 of Left v -> return (Right v) Right (o2,k2) -> k1 o2 <~> k2 o1++-- | A basic runner function. Provide the ReacT and a handler in the underlying monad to run.+runReacT :: Monad m => ReacT input output m a -> (output -> m input) -> m a+runReacT (ReacT r) handler = do+ inner <- r+ case inner of+ Left a -> return a+ Right (output,fr) -> do+ next_input <- handler output+ runReacT (fr next_input) handler
monad-resumption.cabal view
@@ -2,9 +2,10 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: monad-resumption-version: 0.1.0.1+version: 0.1.1.0 synopsis: Resumption and reactive resumption monads for Haskell.-description: Resumption and reactive-resumption monads for Haskell.+description: This package contains the definitions of Resumption and Reactive Resumption Monads. + These monads can be used to construct structures such as coroutines and iteratees. homepage: https://github.com/igraves/resumption_monads license: BSD3 license-file: LICENSE@@ -15,6 +16,9 @@ build-type: Simple extra-source-files: README.md cabal-version: >=1.10+source-repository head+ type: git+ location: https://github.com/igraves/monad-resumption.git library exposed-modules: