runCollectActor :: CollectActor a b -> Process ()
runCollectActor (CollectActor step start fini) = do
    -- Obtain parameters
    (acp,ParamActor parent rnk grp) <- expect
    -- Create channels for communication
    (chSendParam,chRecvParam) <- newChan
    (chSendDst,  chRecvDst  ) <- newChan
    (chSendN,    chRecvN    ) <- newChan
    -- Send shell process description back
    let shell = Shell (SingleActor acp)
                      (RecvReduce [(chSendN,chSendParam)])
                      (SendVal    chSendDst)
    send parent (acp, wrapMessage shell)
    -- Start execution of an actor
    !b <- runDNA acp rnk grp $ do
        s0 <- start
        s  <- gatherM (Group chRecvParam chRecvN) step s0
        fini s
    sendToDestChan chRecvDst b

-- | Start execution of collector actor
runCollectActor :: CollectActor a b -> Process ()
runCollectActor (CollectActor step start fini) = do
    -- Obtain parameters
    (acp,ParamActor parent rnk grp) <- expect
    -- Create channels for communication
    (chSendParam,chRecvParam) <- newChan
    (chSendDst,  chRecvDst  ) <- newChan
    (chSendN,    chRecvN    ) <- newChan
    -- Send shell process description back
    let shell = Shell (SingleActor acp)
                      (RecvReduce [(chSendN,chSendParam)])
                      (SendVal    chSendDst)
    send parent (acp, wrapMessage shell)
    -- Start execution of an actor
    !b <- runDNA acp rnk grp $ do
        s0 <- start
        s  <- gatherM (Group chRecvParam chRecvN) step s0
        fini s
    sendToDestChan chRecvDst b

-- | Start execution of collector actor
runCollectActor (CollectActor step start fini) = do
    -- Obtain parameters
    (acp,ParamActor parent rnk grp) <- expect
    -- Create channels for communication
    (chSendParam,chRecvParam) <- newChan
    (chSendDst,  chRecvDst  ) <- newChan
    (chSendN,    chRecvN    ) <- newChan
    -- Send shell process description back
    let shell = Shell (SingleActor acp)
                      (RecvReduce [(chSendN,chSendParam)])
                      (SendVal    chSendDst)
    send parent (acp, wrapMessage shell)
    -- Start execution of an actor
    !b <- runDNA acp rnk grp $ do
        s0 <- start
        s  <- gatherM (Group chRecvParam chRecvN) step s0
        fini s
    sendToDestChan chRecvDst b

-- | Start execution of collector actor