[reactive] Composable adapters and multiple event sources

David Sankel camior at gmail.com
Mon Nov 10 17:55:45 EST 2008


On Mon, Nov 10, 2008 at 1:04 PM, pierre <k.pierre.k at gmail.com> wrote:
>
> Hello,
>
> I'm trying to write simple GTK2hs adapter using new reactive library.
>
> However, I've ran into some issues there:
>
> 1. All of the adapters i've seen come with static "primitive signals",
> like FRP.Reactive.GLUT.Adapter.UI. But this doesn't seem to be
> applicable to UIs like "UI loaded from glade file" because it's
> impossible to create all signals in advance -- you should be able to
> create them with functions like:
>
> mkButton :: Glade -> String -> IO (Event ())
>
> but that doesn't seem to fit well into FRP.Reactive.LegacyAdapters
interface.

Hrm, I'm having trouble understanding the situation here. What would the
context around mkButton look like? Are you looking for something like the
following?

data WidgetHeiarchy = Button Identifier (Event ())
                    | Frame Identifyer [WidgetHeiarchy]
                    | ...

data WidgetHeiarchyStates = SButton Color
                          | ...

adapt :: Glade -> (WidgetHeiarchy -> Behavior WidgetHeiarchyStates ) -> IO()

> 2. Is stacking of multiple adapters possible? In my view it's
> essential feature for many applications, GUI network clients, for example.

I agree that it's an essential feature. If your event generators and
behavior sinks can all run on separate threads, you're good to go. The
situation gets complicated when event generators or behavior sinks all
require blocking on the main thread. We had some simple legacy adapters at
one point (forkE forkB), but I'm not sure if they're still in the source
somewhere.

--
David Sankel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/reactive/attachments/20081110/b1abb657/attachment.htm


More information about the Reactive mailing list