-- | Create promise for single actor. It allows to receive data from
--   it later.
delay :: Serializable b => Location -> Shell a (Val b) -> DNA (Promise b)
delay loc (Shell child _ src) = do
    myACP           <- getMonitor
    (chSend,chRecv) <- liftP newChan
    let param :: Serializable b => SendEnd (Val b) -> SendPort b -> Process ()
        param (SendVal ch) p = sendChan ch $ destFromLoc loc p
    liftP   $ param src chSend
    sendACP $ ReqConnect child (SingleActor myACP) []
    return  $ Promise chRecv

-- | Create promise from group of processes which allows to collect
--   data from them later.
delay :: Serializable b => Location -> Shell a (Val b) -> DNA (Promise b)
delay loc (Shell child _ src) = do
    myACP           <- getMonitor
    (chSend,chRecv) <- liftP newChan
    let param :: Serializable b => SendEnd (Val b) -> SendPort b -> Process ()
        param (SendVal ch) p = sendChan ch $ destFromLoc loc p
    liftP   $ param src chSend
    sendACP $ ReqConnect child (SingleActor myACP) []
    return  $ Promise chRecv

-- | Create promise from group of processes which allows to collect
--   data from them later.
delay loc (Shell child _ src) = do
    myACP           <- getMonitor
    (chSend,chRecv) <- liftP newChan
    let param :: Serializable b => SendEnd (Val b) -> SendPort b -> Process ()
        param (SendVal ch) p = sendChan ch $ destFromLoc loc p
    liftP   $ param src chSend
    sendACP $ ReqConnect child (SingleActor myACP) []
    return  $ Promise chRecv

-- | Create promise from group of processes which allows to collect
--   data from them later.