mirror of
https://github.com/github/semantic.git
synced 2024-11-24 17:04:47 +03:00
Free.flatMap
rethrows errors.
This commit is contained in:
parent
feabaa01a7
commit
9228031f5d
@ -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) }) })
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user