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
2
votes
0 answers

WxHaskell and DragAndDrop: how to create custom event to trigger dropTargetOnData, dropTargetOnDrop, dropTargetOnEnter, dropTargetOnDragOver

WxHaskell and DragAndDrop I would like to know how to use the following events handlers : dropTargetOnData, dropTargetOnDrop, dropTargetOnEnter, dropTargetOnDragOver….[1] Could you check if my current believes are corrects : From wx Widgets/…
Luc Taesch
  • 193
  • 6
2
votes
1 answer

Is there an issue with an Event and a Behavior having the same initial value?

There's something I find unsatisfying with the below code. As I develop bGameState, I will add more events. Will the fact that playerInputE (and I imagine other Events) share the same initial value lead to problems? In other words, is my initial…
user1198582
2
votes
0 answers

Separating State for a Model and GUI IO ( Wx) : Stack or FRP?

For my diagramming tool, I'd like to keep the code of the core model isolated from the GUI. In the following example, the "state " is passed around with vDiag, which is a Tvar. This is a design decision in wx. Now, For my diagramming tool, I 'd…
2
votes
1 answer

Functional Banana Traveller - putting together Behavior t GameState

The problem is that I do not know how to create the Behavior of type Behavior t GameState I have more code, but am trying to just show what I think is neccessary to talk about the problem. Let me know if there are blanks to be filled in. Here's what…
user1198582
2
votes
1 answer

Implementing a timer in Traveller game

This problem is a continuation of what I started here. I'm using the asteroid example as a model to work from. The problem I want to talk about here is the one of a timer. The asteroids example uses the event0 function to make one, which relies on…
user1198582
2
votes
1 answer

Cabal install reactive-banana-wx on ubuntu 12.04

I just did a fresh install of Ubuntu 12.04 pulling down haskell-platform from apt-get and when i try to install reactive-banana-wx i get: cabal install reactive-banana-wx Resolving dependencies... In order, the following would be…
2
votes
2 answers

What is the equivalent of reactive-web's flatMap in Haskell's reactive-banana?

I'm looking for the function in reactive-banana that will choose from which event stream to emit next depending on the incoming value of another event stream or signal (Behaviour ?). In the library for scala, reactive-web this is done with: …
miguel.negrao
  • 949
  • 5
  • 13
1
vote
1 answer

Events from shared communication channel between threads

I have a program that solves some problem and I decided I would like to monitor in a nice GUI what it does. For GUI I chose Gtk which means that I need to run mainGUI loop in a dedicated thread and the rest of my program will occupy a different…
jakubdaniel
  • 2,233
  • 1
  • 13
  • 20
1
vote
2 answers

Should I be able to compile reactive-banana-wx with "stack build" alone?

I cloned reactive-banana and tried to build the reactive-banana-wx example: git clone http://github.com/HeinrichApfelmus/reactive-banana.git cd reactive-banana/reactive-banana-wx stack build There is a stack.yaml in that directory, and it does…
kostmo
  • 6,222
  • 4
  • 40
  • 51
1
vote
1 answer

Getting updates from accumB without delay

THe documentation for accumB says: Note: As with stepper, the value of the behavior changes "slightly after" the events occur. This allows for recursive definitions. In my case there is no recursion, but i want to get updates "right now", not…
arrowd
  • 33,231
  • 8
  • 79
  • 110
1
vote
1 answer

reactive-banana how to do IO events correctly

Based on my previous question whose setting I refined gradually (How to create monadic behaviour in reactive-banana): Suppose there is eKey, an event fired whenever a key is pressed, b of type Buffer which is modified appropriately whenever a…
jakubdaniel
  • 2,233
  • 1
  • 13
  • 20
1
vote
1 answer

How to create monadic behaviour in reactive-banana

Suppose I catch key presses and manipulate a code buffer accordingly: let bCode = accumB emptyCode eModifications eCodeChanges <- changes bCode I would like to create another behaviour bEval bEval = accumB freshEnv (magic eCodeChanges) which…
jakubdaniel
  • 2,233
  • 1
  • 13
  • 20
1
vote
1 answer

reactive-banana webkit DOM boilerplate

Is there (or does it make sense for it to be) a reactive-banana over webkitgtk3's DOM? Originally I was looking for reactive-banana-gtk but then realized the widgets were to rigid and I saw no easy way to define new widgets from Haskell. DOM…
jakubdaniel
  • 2,233
  • 1
  • 13
  • 20
1
vote
1 answer

Reactive Banana: Change status in data

Starting from the Counter example in Reactive Banana Wx that uses a normal Int to keep the counter status: let networkDescription :: forall t. Frameworks t => Moment t () networkDescription = do eup <- event0 bup command edown <-…
Randomize
  • 8,651
  • 18
  • 78
  • 133
1
vote
1 answer

Unzip an event stream of tuple 2 into two streams

In reactive-banana, given Event t (a, b), how would you lead it to (Event t a, Event t b)? Traversable#sequence seems to solve it with some instance of Monad for (,) provided, but Event t is only Functor.
Ryoichiro Oka
  • 1,949
  • 2
  • 13
  • 20