makeTopLevelPartPN :: NetworkIF network => [Part network] -> Part network -> PN SimFlow SimValue
    makeTopLevelPartPN parts part = pn
        where
            (_, pn) = runMkPNMonad0 $ do
                portChans <- makePartPN parts part
                case (goPort, donePort) of
                    (Just go, Nothing) -> teakR (portChans !! go)
                    (Just go, Just _done) -> teakR (portChans !! go)
                    _ -> return ()

            ports = networkPorts part
            goPort = findIndex (fromMaybe False . liftM (== GoAccess) . nwPortRef) ports
            donePort = findIndex (fromMaybe False . liftM (== DoneAccess) . nwPortRef) ports

    -- runPN :: (Show value, Monad m) => (a -> m ()) -> PN m value -> Marking value -> [a] -> m (Marking value)
makeTopLevelPartPN :: NetworkIF network => [Part network] -> Part network -> PN SimFlow SimValue
makeTopLevelPartPN parts part = pn
        where
            (_, pn) = runMkPNMonad0 $ do
                portChans <- makePartPN parts part
                case (goPort, donePort) of
                    (Just go, Nothing) -> teakR (portChans !! go)
                    (Just go, Just _done) -> teakR (portChans !! go)
                    _ -> return ()

            ports = networkPorts part
            goPort = findIndex (fromMaybe False . liftM (== GoAccess) . nwPortRef) ports
            donePort = findIndex (fromMaybe False . liftM (== DoneAccess) . nwPortRef) ports

    -- runPN :: (Show value, Monad m) => (a -> m ()) -> PN m value -> Marking value -> [a] -> m (Marking value)
makeTopLevelPartPN parts part = pn
        where
            (_, pn) = runMkPNMonad0 $ do
                portChans <- makePartPN parts part
                case (goPort, donePort) of
                    (Just go, Nothing) -> teakR (portChans !! go)
                    (Just go, Just _done) -> teakR (portChans !! go)
                    _ -> return ()

            ports = networkPorts part
            goPort = findIndex (fromMaybe False . liftM (== GoAccess) . nwPortRef) ports
            donePort = findIndex (fromMaybe False . liftM (== DoneAccess) . nwPortRef) ports

    -- runPN :: (Show value, Monad m) => (a -> m ()) -> PN m value -> Marking value -> [a] -> m (Marking value)