1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 00:12:29 +03:00

Free.flatMap rethrows errors.

This commit is contained in:
Rob Rix 2015-10-28 11:57:29 -04:00
parent feabaa01a7
commit 9228031f5d

View File

@ -94,8 +94,8 @@ public enum Free<Leaf, Annotation, Value>: CustomDebugStringConvertible {
// MARK: Monad
public func flatMap<C>(@noescape transform: Value -> Free<Leaf, Annotation, C>) -> Free<Leaf, Annotation, C> {
return analysis(ifPure: transform, ifRoll: { .Roll($0, $1.map { $0.flatMap(transform) }) })
public func flatMap<C>(@noescape transform: Value throws -> Free<Leaf, Annotation, C>) rethrows -> Free<Leaf, Annotation, C> {
return try analysis(ifPure: transform, ifRoll: { try .Roll($0, $1.map { try $0.flatMap(transform) }) })
}