1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Nothing ever flat maps an Algorithm.

This commit is contained in:
Rob Rix 2015-11-03 11:13:59 -05:00
parent c15c2715f5
commit 90cd2ee2d7

View File

@ -33,13 +33,6 @@ public enum Algorithm<Term: CofreeType, Result> {
public func map<Other>(transform: Result -> Other) -> Algorithm<Term, Other> {
return analysis(ifPure: transform >>> Algorithm<Term, Other>.Pure, ifRoll: { .Roll($0.map { $0.map(transform) }) })
}
// MARK: Monad
public func flatMap<C>(transform: Result -> Algorithm<Term, C>) -> Algorithm<Term, C> {
return analysis(ifPure: transform, ifRoll: { .Roll($0.map { $0.flatMap(transform) }) })
}
}