[Haskell-beginners] dynamic set of objects in netwire

Nathan Hüsken nathan.huesken at posteo.de
Thu Nov 8 18:58:42 CET 2012


On 11/07/2012 07:46 PM, Ertugrul Söylemez wrote:
> Nathan Hüsken <nathan.huesken at posteo.de> wrote:
> 
>> I need (in netwire) a way to handle a dynamic set of objects.
>> Therefor I need a way of growing and shrinking the set. Since I have
>> little experience with Haskell and FRP, I would appreciate some input.
>>
>> Shrinking is not problem, as I can just remove wires that inhibit. But
>> how to let the set grow?
> 
> Originally the 4.0.0 release should include the manager wire, but I have
> long tried to come up with an interface that is generic enough to fit in
> as many situations as possible.
> 
> The most obvious interface is through input.  However, this really only
> works when only the user of the manager should be able to add or remove
> subwires.  The interface is as simple as something like this:
> 
>     data MgrMsg k e m a b =
>         Add k (Wire e m a b) |
>         Delete k
> 
>     managerBasic ::
>         (Monad m, Monoid b, Ord k) =>
>         Wire e m (a, [MgrMsg k e m a b]) b

Mmh, how could you (form the outside) connect the output to the
induvidual managed wires?
Let's say I from one of the values in the output "b" I decide I want to
delete the corresponding wire? I need to know the key "k". OK, I could
encode "k" in the output but should I then not explicitly return "k"
with it?

Regards,
Nathan



More information about the Beginners mailing list