From :: (MonadCatch m, Show ann, Typeable ann) => AnProcess ann -> m (S.Set ProcessPosition)
pfFrom process = from' process True
    where
    from' proc b
        | ProcessNull _ <- proc  = return S.empty
        | otherwise = do
        res <- foldM (addWithRecursive proc) S.empty (next proc)
        return $ singletonOrEmpty (conditionAction proc b) `S.union` res
    singletonOrEmpty True  =  S.singleton []
    singletonOrEmpty False =  S.empty
    conditionAction proc b = not (blocking proc) && b -- condition to add singleton set is given, see Def. 14 in paper
    addWithRecursive proc accu pos = do
                        p'   <- processAt proc pos
                        res  <- from' p' (blocking proc)
                        return $ accu `S.union` (pos <.> res)

-- | Combine set of sets of position so that they describe alternatives (see comment for progressTo)
-- combine x y = { union of xi and yi | xi in x and yi in y}
c
pfFrom :: (MonadCatch m, Show ann, Typeable ann) => AnProcess ann -> m (S.Set ProcessPosition)
pfFrom process = from' process True
    where
    from' proc b
        | ProcessNull _ <- proc  = return S.empty
        | otherwise = do
        res <- foldM (addWithRecursive proc) S.empty (next proc)
        return $ singletonOrEmpty (conditionAction proc b) `S.union` res
    singletonOrEmpty True  =  S.singleton []
    singletonOrEmpty False =  S.empty
    conditionAction proc b = not (blocking proc) && b -- condition to add singleton set is given, see Def. 14 in paper
    addWithRecursive proc accu pos = do
                        p'   <- processAt proc pos
                        res  <- from' p' (blocking proc)
                        return $ accu `S.union` (pos <.> res)

-- | Combine set of sets of position so that they describe alternatives (see comment for progressTo)
-- combine x y = { union of xi and yi | xi in x and yi in y}
pfFrom process = from' process True
    where
    from' proc b
        | ProcessNull _ <- proc  = return S.empty
        | otherwise = do
        res <- foldM (addWithRecursive proc) S.empty (next proc)
        return $ singletonOrEmpty (conditionAction proc b) `S.union` res
    singletonOrEmpty True  =  S.singleton []
    singletonOrEmpty False =  S.empty
    conditionAction proc b = not (blocking proc) && b -- condition to add singleton set is given, see Def. 14 in paper
    addWithRecursive proc accu pos = do
                        p'   <- processAt proc pos
                        res  <- from' p' (blocking proc)
                        return $ accu `S.union` (pos <.> res)

-- | Combine set of sets of position so that they describe alternatives (see comment for progressTo)
-- combine x y = { union of xi and yi | xi in x and yi in y}