Questions tagged [reactive-banana]

reactive banana is a Haskell library for functional reactive programming

Reactive Banana:

Functional reactive programming 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.

The goal of the library is to provide a solid foundation.

115 questions
6
votes
2 answers

State-dependent event processing with state updates

I want to use FRP (i.e., reactive banana 0.6.0.0) for my project (a GDB/MI front-end). But I have troubles declaring the event network. There are commands from the GUI and there are stop events from GDB. Both need to be handled and handling them…
copton
  • 338
  • 1
  • 9
6
votes
1 answer

Implementing zipE :: Event t a -> Event t b -> Event t (a,b)

I am new to reactive banana and FRP in general, so apologies if I am missing something obvious. For my project (a GDB/MI front-end) I am using reactive banana (version 0.6.0.0) for both the GUI and the front-end logic modules. The former works great…
copton
  • 338
  • 1
  • 9
6
votes
1 answer

Reactive-banana: up-to-date values from fromPoll

I'm writing a music player in Haskell with reactive-banana. One problem I have is fetching up-to-date values with fromPoll. I want to enable the user to optionally select a part of the track while playing. My code looks something like…
oggy
  • 3,483
  • 1
  • 20
  • 24
6
votes
1 answer

What is the order of event handling for the spill function in Reactive-Banana?

I tested this and it seems that the order of event handling is the same as the order of the list in the source event. I don't think I can rely on this as the documentation only states: Emit simultaneous event occurrences. Up to strictness, we have…
llayland
  • 203
  • 1
  • 5
5
votes
1 answer

Reactive Banana: how to use values from a remote API and merge them in the event stream

I am using Reactive-Banana in a WX interface. I need to retrieve a value from an external service API when a button is pressed. I have a generic Behavior based on the data type AppState that “accums” the transformed changes based on a function…
Randomize
  • 8,651
  • 18
  • 78
  • 133
5
votes
1 answer

Testing in reactive-banana

Is there a way to unit test networks created in reactive banana? Say I've built up some network with some input events - is it possible to verify that events have produced some output stream/behaviours have some value after some number of input…
Callum Rogers
  • 15,630
  • 17
  • 67
  • 90
5
votes
1 answer

How to make Behaviors contain other Behaviors in reactive-banana

It appears that everyone is doing a computer game with reactive-banana FRP framework, so I had to try that too. However, I'm stuck with the early steps, trying to describe the game data as reactive-banana Behavior types. Basically, I'm trying to…
ipuustin
  • 108
  • 6
4
votes
1 answer

installing reactive-banana-wx

when you try to install the library reactie-banana-wx, get the error: src\CRUD.hs:10:18: Could not find module `Data.Map': It is a member of the hidden package `containers-0.4.0.0'. Perhaps you need to add `containers' to the build-depends in your…
Dima
  • 41
  • 2
4
votes
1 answer

Implementation of ifB in reactive-banana

I am reading Conal Elliot's paper "Declarative Event-Oriented Programming" which has its examples written using a Fran library which is now obsolete. As I am learning FRP I try to implement those examples using reactive-banana. I seem to have no…
dimsuz
  • 8,969
  • 8
  • 54
  • 88
4
votes
3 answers

Filter duplicate events in reactive-banana

Let's say I have x :: Event t (A,B) I can get the first component of it: fst <$> x :: Event t A However, this event will fire even when the first component doesn't change. I want to avoid that, because it would trigger an expensive…
Roman Cheplyaka
  • 37,738
  • 7
  • 72
  • 121
4
votes
1 answer

Functional Banana Traveller - What's wrong with my tick event?

I'm trying to implement a tick event, and have a little test below that demonstrates that it doesn't work. I'd appreciate insight as to why it doesn't work. gameloop :: TChan UAC -> IO () gameloop commandChannel = do (tickHandler,…
user1198582
4
votes
2 answers

How to transform events with an IO function?

Let's say I have e1 :: Event t A f :: A -> IO B I want to create e2 :: Event t B which is triggered by e1, and whose values are determined by executing f on the value of e1 at the time of the event occurrence. I see two potential ways to do this,…
Roman Cheplyaka
  • 37,738
  • 7
  • 72
  • 121
4
votes
1 answer

reactive-banana reactimate to retrieve the widget textCtrl Value like textCtrlGetValue

I would like to retrieve the widget value. In the following, pressing the button b retrieve s_in and print it , in native wxhaskell. b <- button f [text:= "print text in console", on command := textCtrlGetValue s_in >>=…
Luc Taesch
  • 193
  • 6
4
votes
1 answer

Functional Reactive Banana - type confusion

Heinrich Apfelmus generously chimed in on this problem. I had considered using accumB as a solution, but thought there would be a type error. After trying his suggestion anyway, I did recieve a type error. let bGameState :: Behavior t GameState …
user1198582
4
votes
1 answer

Full Click/KeyPress Event with Reactive-banana and SDL

A full click event is a button down and up, without mouse motion, as far as I know. SDL only gives me Button Up and Down events. Does reactive-banana have any way to express "key down and then key up"? Incidentally, if I want to have an event that…
Lanbo
  • 15,118
  • 16
  • 70
  • 147