[Haskell-beginners] dynamic set of objects in netwire

Nathan Hüsken nathan.huesken at posteo.de
Thu Nov 8 22:33:56 CET 2012


On 11/08/2012 06:58 PM, Nathan Hüsken wrote:
> 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?

Acually I am just realizing that I can "plumb" my wires so, that its
output is (k,b) to get exactly this effect.



More information about the Beginners mailing list