reactive-banana
Library for functional reactive programming (FRP).
http://wiki.haskell.org/Reactive-banana
| LTS Haskell 24.18: | 1.3.2.0@rev:6 | 
| Stackage Nightly 2025-11-04: | 1.3.2.0@rev:6 | 
| Latest on Hackage: | 1.3.2.0@rev:6 | 
reactive-banana-1.3.2.0@sha256:81fba9c7dd41029d54c4b41d31d71e997355da8868d12bc8f7fd5384b9f45dce,6003Module documentation for 1.3.2.0
- Control
- Control.Event
 
 - Reactive
- Reactive.Banana
- Reactive.Banana.Combinators
 - Reactive.Banana.Frameworks
 - Reactive.Banana.Model
 - Reactive.Banana.Prim
- Reactive.Banana.Prim.High
 - Reactive.Banana.Prim.Low
 - Reactive.Banana.Prim.Mid
 
 
 
 - Reactive.Banana
 
Reactive-banana is a library for Functional Reactive Programming (FRP).
FRP offers an elegant and concise way to express interactive programs such as graphical user interfaces, animations, computer music or robot controllers. It promises to avoid the spaghetti code that is all too common in traditional approaches to GUI programming.
See the project homepage http://wiki.haskell.org/Reactive-banana for more detailed documentation and examples.
Stability forecast. This is a stable library, though minor API changes are still likely. It features an efficient, push-driven implementation and has seen some optimization work.
API guide.
Start with the Reactive.Banana module.
Changes
Changelog for the reactive-banana package
Version 1.3.2.0 (2023-01-22)
- Fixed multiple space leaks for dynamic event switching by completely redesigning low-level internals. Added automated tests on garbage collection and space leaks in order to make sure that the leaks stay fixed. #261, #267, #268
 
Version 1.3.1.0 (2022-08-11)
- Various internal performance improvements. #257, #258
 - Fix a space leak in dynamic event switching. #256
 - Reduce memory usage of 
stepper/accumB. #260 - Prevent a deadlock if the network crashes when evaluating a 
BehaviororEvent. #262 
Version 1.3.0.0 (2022-03-28)
- Added 
SemigroupandMonoidinstances toMomentandMomentIO. #223 - Add 
@>operator. #229 switchEnow takes an initial event. This is breaking change. The previous behavior can be restored by usingswitchE never. #165- Triggering an 
AddHandlerno longer allocates, leading to a minor performance improvement. #237 - A new 
oncecombinator has been added that filters anEventso it only fires once. #239 MonadMomentinstances have been added for all possibly monad transformers (from thetransformerslibrary). #248- Some internal refactoring to reduce allocations and improve performance. #238
 - The 
Reactive.Banana.Primhierarchy has been changed to better reflect the abstraction hierarchy. #241 
Version 1.2.2.0
- Optimize the implementation of 
Graph.listParents#209 - Replace a use of 
foldlwithfoldl'. #212 - Simplify the internal 
mkWeakIOReffunction. #154 - Add 
mergeandmergeWithcombinators. #163, #220 - Make internal SCC pragmas compatible with the GHC 9.0 parser. #208
 - Change 
insertWith (flip (++))toinsertWith (++)ininsertEdge. #211 - Add 
Semigroup a => Semigroup (Behavior a)andMonoid a => Monoid (Behavior a)instances. #185 - Loosen the upper-bound for 
hashableandsemigroups. #205 
version 1.2.1.0
- Add 
Num,Floating,Fractional, andIsStringinstances forBehavior. #34 - Support 
containers-0.6. #191 
version 1.2.0.0
- Make 
MonadFixsuperclass ofMonadMoment. #128 - Add 
SemigroupandMonoidinstances forEvent. #104 - Semigroup compatibility with GHC 8.4.1 #168
 - Increased upper-bound on 
pqueue. 
version 1.1.0.1
- Adapt library to work with GHC-8.0.1.
 
version 1.1.0.0
- Fix bug: Types of 
switchBandswitchEneed to be in theMomentmonad. - Clean up and simplify model implementation in the 
Reactive.Banana.Modelmodule. - Update type signatures of the 
interpret*functions to make it easier to try FRP functions in the REPL. - Remove 
showNetworkfunction. 
version 1.0.0.1
- Improve documentation.
- Add prose section on recursion.
 - Improve explanation for the 
changesfunction. 
 - Bump 
transfomersdependency. - Remove defunct 
UseExtensionsflag from cabal file. 
version 1.0.0.0
The API has been redesigned significantly in this version!
- Remove phantom type parameter 
tfromEvent,BehaviorandMomenttypes.- Change accumulation functions (
accumB,accumE,stepper) to have a monadic result type. - Merge module 
Reactive.Banana.Switchinto moduleReactive.Banana.Combinators. - Simplify types of the switching functions (
switchE,switchB,observeB,execute). - Remove functions 
trimEandtrimB. - Remove types 
AnyMomentandIdentity. 
 - Change accumulation functions (
 - Remove 
Frameworksclass constraint, useMomentIOtype instead.- Add class 
MonadMomentfor both polymorphism over theMomentandMomentIOtypes. 
 - Add class 
 - Change type 
Eventto only allow a single event per moment in time.- Remove function 
union. UseunionWithinstead. - Change function 
unionsto only merge events of typeEvent (a -> a). 
 - Remove function 
 - Remove module 
Reactive.Banana.Experimental.Calm. - Change the model implementation in the module 
Reactive.Banana.Modelto the new API as well. 
Other changes:
- Add 
mapEventIOutility function to build an Event that contains the result of an IO computation. - Add 
newBehaviorutility function to build a Behavior that can be updated with aHandler. - Add illustrations to the API documentation.
 
version 0.9.0.0
- Implement garbage collection for dynamically switched events.
 - Fix issue #79 where recursive declarations would sometimes result in dropped events.
 - Limit value recursion in the 
Momentmonad slightly. - Change 
initialandvalueBto behave subtly different when it comes to value recursion in theMomentmonad. - Add 
Functor,ApplicativeandMonadinstances for theFrameworksMomenttype. - Depend on the pqueue package instead of the psqueues package again, as the former has been updated to work with the current version of GHC.
 
version 0.8.1.2
version 0.8.1.1
- Links to the Haskell wiki now point to the 
http://wiki.haskell.orgsubdomain. 
version 0.8.1.0
- Module 
Reactive.Banana.Switchnow adheres to the “Functor Applicative Monad Proposal” proposal]amp-proposal. 
version 0.8.0.4
- Just a re-upload. The previous archive was broken.
 
version 0.8.0.3
- Export the 
Futuretype. - Restrict 
containersdependency to lower bound 0.5. 
version 0.8.0.2
- Fix compilation issue with hiding 
emptyfrom the moduleReactive.Banana.Prim.Order. 
version 0.8.0.1
- New examples 
Counter.hsandOctave.hs. - Bump 
transfomersdependency. 
version 0.8.0.0
- A new module 
Reactive.Banana.Primexports primitive combinators that you can use to implement your own FRP library with a different API. - The push-driven implementation in 
Reactive.Banana.Primnow has the performance characteristics of an actual push-driven implementation. Some work has gone into optimizing constant factors as well. However there is still no garbage collection for dynamically created events and behaviors. - The 
accumEandaccumBcombinators evaluate their state to WHNF to avoid a space leak. (Fixes issue #52). On the other hand,Behaviorvalues are evaluated on demanded, i.e. only when required by the apply combinator<@>or similar. - Recursion between events and behaviors should now work as advertised. (Fixed issue #56).
 - The deprecated 
liftIONowfunction has been removed. - The type of the 
changesfunction now indicates that the new Behavior value is only available in the context ofreactimate. A variantreactimate'makes this explicit. - The module 
Control.Event.Handlernow exports theAddHandlertype, which is now anewtype. The moduleReactive.Banana.Frameworks.AddHandlerhas been removed. 
version 0.7.1.0
- Deprecate the 
liftIONowfunction in favor ofliftIO. 
version 0.7.0.0
- Dynamic event switching. Combinators are now available in the module 
Reactive.Banana.Switch. - Rename 
NetworkDescriptiontoMoment, add class constraintFrameworks t. - No longer compiles with the JavaScript backend of the Utrecht Haskell compiler.
 - Change the 
changescombinator to be less useful. 
version 0.6.0.0
- Can now be compiled with the JavaScript backend of the Utrecht Haskell compiler.
 - The push-driven implementations needs the 
UseExtensionsflag to work. This flag is enabled by default. - Minor module reorganization.
 
version 0.5.0.0 – announcement
This update includes numerous changes, in particular a complete overhaul of the internal implementation. Here a partial list.
- Add 
collect,spillandunionWithcombinators to deal with simultaneous events. - Remove general 
Monoidinstance forEventto simplify reasoning about simultaneous events. - Add 
initialandchangescombinators that allow you to observe updates toBehavior. Remove theReactive.Banana.Incrementalmodule. - Rename most modules,
 - Change type signatures: The main types 
Event,BehaviorandNetworkDescriptionnow carry an additional phantom type. 
version 0.4.3.1
- Model implementation of 
accumEnow has the intended semantics. 
version 0.4.3.0
- Change semantics: 
IOactions from insidereactimatemay now interleave as dictated by your event-based framework (issue #15). - Fix bug: compiling a network twice no longer fails due to lingering global state (issue #16).
 - Change type: remove 
Typeableconstraint frominterpretandinterpretAsHandler. - Misc: Remove the 
BlackBoardapplication from the repository. 
version 0.4.2.0
- Change type: remove 
Typeableconstraint fromfromAddHandler. - Misc: the 
Vaultdata type gets its own package. - Misc: 
reactive-banana-wxnow compiles properly with cabal. - Add some more examples to the 
reactive-banana-wxpackage. 
version 0.4.1.0
- Add 
<@>operator for more convenience when usingapply. - Add support for value recursion to the 
NetworkDescriptionmonad. - Add many examples to 
reactive-banana-wx. 
version 0.4.0.0 – announcement
- Add function 
fromPollto obtain behaviors from mutable data. - Change name: 
runis now calledactuate. - Add derived data type 
Discrete. - Add function 
interpretAsHandler. 
version 0.3.0.0 – announcement
- change: event networks are now first-class values, you can 
pauseorrunthem. - change type: 
AddHandlernow expects a way to unregister event handlers. - add example 
RunPause.hs 
version 0.2.0.0 – announcement
- change: now implements proper semantics as pioneered by Conal Elliott
 - model implementation for semantics
 - push-driven implementation for efficiency
 - add example 
SlotMachine.hs 
version 0.1.0.0
- initial release