Issue #527

import Foundation
import Combine

public typealias TaskCompletion = (Result<(), Error>) -> Void

public protocol Task: AnyObject {
    var name: String { get }
    func run(workflow: Workflow, completion: TaskCompletion)
}

public extension Task {
    func asPublisher(workflow: Workflow) -> AnyPublisher<(), Error> {
        return Future({ completion in
            self.run(workflow: workflow, completion: completion)
        }).eraseToAnyPublisher()
    }
}

let sequence = Publishers.Sequence<[AnyPublisher<(), Error>], Error>(
    sequence: tasks.map({ $0.asPublisher(workflow: self) })
)