
Nathan Hüsken
I am trying to write a netwire combiner similar to multicast. The only difference is that when one of the wires inihibts, I want to remove it from the list.
So this is my attempt:
manager :: (Monad m) => [Wire e m a b] -> Wire e m [a] [b] manager ws' = mkGen $ \dt xs' -> do res <- mapM (\(w,x) -> stepWire w dt x) $ zip ws' xs' let filt (Left a, b) = Just (a, b) filt _ = Nothing resx = mapMaybe filt res return (Left $ (fmap fst) resx,manager (fmap snd resx))
Notice that Left means inhibition. You seem to be filtering out produced results and trying to keep only the inhibition values, which of course does not make much sense and triggers the type error you are seeing. Also your interface seems very unsafe to me. I suggest the following interface instead: shrinking :: (Monad m) => [Wire e m a b] -> Wire e m a [b] Then normally 'a' could be something like Map K A. 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.