packages feed

essence-of-live-coding 0.2.0.1 → 0.2.1

raw patch · 4 files changed

+21/−10 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- LiveCoding.External: runWriterC :: Monad m => Cell (WriterT w m) a b -> Cell m a (b, w)
+ LiveCoding: runWriterC :: (Monoid w, Monad m) => Cell (WriterT w m) a b -> Cell m a (w, b)
+ LiveCoding.Cell.Monad.Trans: runWriterC :: (Monoid w, Monad m) => Cell (WriterT w m) a b -> Cell m a (w, b)

Files

CHANGELOG.md view
@@ -1,5 +1,14 @@ # Revision history for essence-of-live-coding +## 0.2.1++* Adapted pulse backend to handles and refactored++## 0.2.0.1++* Bug fixes+* Version bounds+ ## 0.2.0.0  * Adapted gloss backend to handles and refactored
essence-of-live-coding.cabal view
@@ -1,5 +1,5 @@ name:                essence-of-live-coding-version:             0.2.0.1+version:             0.2.1 synopsis: General purpose live coding framework description:   essence-of-live-coding is a general purpose and type safe live coding framework.@@ -30,7 +30,7 @@ source-repository this   type:     git   location: git@github.com:turion/essence-of-live-coding.git-  tag:      v0.2.0.1+  tag:      v0.2.1   library
src/LiveCoding/Cell/Monad/Trans.hs view
@@ -12,6 +12,7 @@ -- transformers import Control.Monad.Trans.Reader (runReaderT, ReaderT) import Control.Monad.Trans.State.Strict (StateT (..), runStateT, evalStateT)+import Control.Monad.Trans.Writer.Strict  -- essence-of-live-coding import LiveCoding.Cell@@ -63,3 +64,10 @@   => Cell (ReaderT r m) a b   -> Cell m (r, a) b runReaderC' = hoistCellKleisli_ $ \action (r, a) -> runReaderT (action a) r++-- | Run the effects of the 'WriterT' monad,+--   collecting all its output in the second element of the tuple.+runWriterC :: (Monoid w, Monad m) => Cell (WriterT w m) a b -> Cell m a (w, b)+runWriterC = hoistCellOutput $ fmap reorder . runWriterT+  where+    reorder ((b, s), w) = ((w, b), s)
src/LiveCoding/External.hs view
@@ -14,7 +14,7 @@  -- transformers import Control.Monad.Trans.Reader-import Control.Monad.Trans.Writer+import Control.Monad.Trans.Writer.Strict  -- essence-of-live-coding import LiveCoding.Cell@@ -25,12 +25,6 @@  type ExternalLoop eIn eOut = Cell IO eIn eOut -runWriterC :: Monad m => Cell (WriterT w m) a b -> Cell m a (b, w)-runWriterC Cell { .. } = Cell-  { cellStep = \state a -> fmap (\((b, w), s) -> ((b, s), w)) $ runWriterT $ cellStep state a-  , ..-  }- concurrently :: (MonadIO m, Monoid eOut) => ExternalCell m eIn eOut a b -> IO (Cell m a b, ExternalLoop eIn eOut) concurrently externalCell = do   inVar  <- newEmptyMVar@@ -38,7 +32,7 @@   let     cell = proc a -> do       eIn       <- constM (liftIO $ takeMVar inVar)      -< ()-      (b, eOut) <- runWriterC (runReaderC' externalCell) -< (eIn, a)+      (eOut, b) <- runWriterC (runReaderC' externalCell) -< (eIn, a)       arrM (liftIO . putMVar outVar)                     -< eOut       returnA                                            -< b     externalLoop = arrM (putMVar inVar) >>> constM (takeMVar outVar)