8

I am trying to get some experience with reactive-banana, accord to its website, it should support GTK. I was wondering if there is any tutorial/introductory material on how to do that?

I read here in SO that there is a jaek project, but I am more looking for a minimal example for using reactive-banana with gtk2hs (gtk3 from hackage), as I have no prior experience with FRP or reactive-banana.

Also, I tried many many times to get reactive-banana-wx work on Windows/MinGW. Even though I was able to eventually get wxHaskell to install, there were run-time errors up-front (https://stackoverflow.com/questions/23367950/wxc-segfault-in-wxhaskell). I guess I couldn't get wxHaskell to work properly unless I downgrade everything to 2010 or earlier, as there have been no instructions after that on how to make wxHaskell work on Windows, only questions.

I tried installing Gtk2Hs today. Even with gtk3, it was a breeze. That makes me wonder if there is good material for beginners on this route (i.e. reactive-banana + gtk2Hs).

Thanks,

Community
  • 1
  • 1
thor
  • 21,418
  • 31
  • 87
  • 173
  • It might have bitrotted by now, and it may not be a great example, but I used reactive-banana and gtk2hs to do a demo of FRP about a year ago called [Functionally Reactive Solar System](https://github.com/jcurbo/functionally-reactive-solar-system). – James Curbo Apr 30 '14 at 18:53
  • If you want to take inspiration from jaek, start from [`Jaek.UI.FrpHandlers`](https://github.com/JohnLato/jaek/blob/master/src/Jaek/UI/FrpHandlers.hs), see how GTK events are wired in in functions like `clickEvents'`, and then follow on to [`Jaek.UI.FrpTypes`](https://github.com/JohnLato/jaek/blob/master/src/Jaek/UI/FrpTypes.hs), where you can find glue code using `newAddHandler` and `fromAddHandler` (e.g. in `event1`). It uses a rather old version of reactive-banana, but the key things still hold. – duplode Apr 30 '14 at 18:56
  • Thanks for the hints. I will read your examples later when I now more about gtk. Honestly, I don't even know that much about gtk programming. I have some experience in wx programming. So is there such a thing as programming with reactive-banana without worrying about whether it's hooked to wx or gtk? Or is it completely different if you go with wx and with gtk (even if somebody come up with a reactive-banana-gtk someday). – thor Apr 30 '14 at 19:00
  • 1
    The only thing that will be different is the glue code you need to convert GTK/wx events into reactive-banana ones. Once you have a `eClickOK :: Reactive.Banana.Event t ()` you can wire it into your event network without caring whether it came from GTK or wx or Threepenny and so forth. So it can be done as long as the glue code is kept into a separate, self-contained module. – duplode Apr 30 '14 at 19:14
  • When I needed a binding to gtk I used https://github.com/conklech/reactive-banana-gtk - again, not sure how up to date this is. – James Curbo May 01 '14 at 01:39

0 Answers0