sodium 0.11.0.2 → 0.11.0.3
raw patch · 6 files changed
+26/−11 lines, 6 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- FRP.Sodium.Context: once :: (Context r, Context r) => Event r a -> Event r a
+ FRP.Sodium.Context: once :: Context r => Event r a -> Event r a
Files
- examples/tests/unit-tests.hs +15/−1
- sodium.cabal +3/−3
- src/FRP/Sodium.hs +1/−1
- src/FRP/Sodium/Context.hs +2/−2
- src/FRP/Sodium/Internal.hs +1/−1
- src/FRP/Sodium/Plain.hs +4/−3
examples/tests/unit-tests.hs view
@@ -124,7 +124,7 @@ assertEqual "beh3" ["init", "second"] =<< readIORef outRef -- | This demonstrates the fact that if there are multiple updates to a behaviour--- in a given transaction, the last one prevails.+-- in a given transaction, the last one prevails in the result of 'value beh'. beh4 = TestCase $ do outRef <- newIORef [] (push, unlisten) <- sync $ do@@ -138,7 +138,21 @@ unlisten assertEqual "beh4" ["other", "second"] =<< readIORef outRef +-- | This demonstrates the fact that if there are multiple updates to a behaviour+-- in a given transaction, the last one prevails in the result of 'updates beh'. beh5 = TestCase $ do+ outRef <- newIORef []+ (push, unlisten) <- sync $ do+ (beh, push) <- newBehavior "init"+ unlisten <- listen (updates beh) $ \a -> modifyIORef outRef (++ [a])+ return (push, unlisten)+ sync $ do+ push "first"+ push "second"+ unlisten+ assertEqual "beh4" ["second"] =<< readIORef outRef++beh6 = TestCase $ do (ea, push) <- sync newEvent outRef <- newIORef [] unlisten <- sync $ do
sodium.cabal view
@@ -1,7 +1,7 @@ name: sodium-version: 0.11.0.2+version: 0.11.0.3 synopsis: Sodium Reactive Programming (FRP) System-description: +description: A general purpose Reactive Programming (FRP) system. This is part of a project to implement reactive libraries with similar interfaces across a range of programming languages at <http://reactiveprogramming.org/>@@ -166,7 +166,7 @@ FRP.Sodium.Context, FRP.Sodium.IO other-modules: FRP.Sodium.Plain- build-depends: base >= 4.3.0.0 && < 4.8.0.0,+ build-depends: base >= 4.3.0.0 && < 4.9.0.0, containers >= 0.4.0.0 && < 0.6.0.0, mtl >= 2.0.0.0 && < 2.3.0.0 ghc-options: -O2
src/FRP/Sodium.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE GeneralizedNewtypeDeriving, ScopedTypeVariables, DoRec, GADTs,+{-# LANGUAGE GeneralizedNewtypeDeriving, ScopedTypeVariables, RecursiveDo, GADTs, TypeFamilies, EmptyDataDecls, FlexibleInstances #-} {-# OPTIONS_GHC -fno-cse -fno-full-laziness #-} -- | Sodium Reactive Programming (FRP) system.
src/FRP/Sodium/Context.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE TypeFamilies, DoRec, FlexibleContexts, ScopedTypeVariables #-}+{-# LANGUAGE TypeFamilies, RecursiveDo, FlexibleContexts, ScopedTypeVariables #-} -- | Generalization of the Sodium API to allow for parallel processing. module FRP.Sodium.Context where @@ -80,7 +80,7 @@ -- ideally be commutative. coalesce :: (a -> a -> a) -> Event r a -> Event r a -- | Throw away all event occurrences except for the first one.- once :: Context r => Event r a -> Event r a+ once :: Event r a -> Event r a -- | Take each list item and put it into a new transaction of its own. -- -- An example use case of this might be a situation where we are splitting
src/FRP/Sodium/Internal.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE GeneralizedNewtypeDeriving, ScopedTypeVariables, DoRec #-}+{-# LANGUAGE GeneralizedNewtypeDeriving, ScopedTypeVariables, RecursiveDo #-} {-# OPTIONS_GHC -fno-cse -fno-full-laziness #-} module FRP.Sodium.Internal ( C.Event(..),
src/FRP/Sodium/Plain.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE GeneralizedNewtypeDeriving, ScopedTypeVariables, DoRec, GADTs,+{-# LANGUAGE GeneralizedNewtypeDeriving, ScopedTypeVariables, RecursiveDo, GADTs, TypeFamilies, EmptyDataDecls, FlexibleInstances #-} {-# OPTIONS_GHC -fno-cse -fno-full-laziness #-} module FRP.Sodium.Plain where@@ -129,9 +129,10 @@ split = split -- | An event that gives the updates for the behavior. If the behavior was created--- with 'hold', then 'updates' gives you an event equivalent to the one that was held.+-- with 'hold', then 'updates' gives you an event like to the one that was held+-- but with only the last firing in any single transaction included. updates :: Behavior a -> Event a-updates = updates_+updates = coalesce (flip const) . updates_ -- | Execute the specified 'Reactive' within a new transaction, blocking the caller -- until all resulting processing is complete and all callbacks have been called.