
Nathan Hüsken
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.
This is a more general problem: How does a subwire /select/ a key for a new wire it wants to create? To most obvious answer is to use the underlying monad, which should be safe enough. Otherwise you can allow adding without a key and the corresponding subwire then gets the key fed back. Greets, Ertugrul -- Not to be or to be and (not to be or to be and (not to be or to be and (not to be or to be and ... that is the list monad.