1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

map using analysis to work around a compiler crash.

This commit is contained in:
Rob Rix 2015-09-17 14:26:59 -04:00
parent ab6cb6c67b
commit 87e4d6ccfc

View File

@ -41,7 +41,11 @@ public enum Stream<A>: NilLiteralConvertible, SequenceType {
public func map<B>(transform: A -> B) -> Stream<B> {
return uncons.map { first, rest in Stream<B>.Cons(transform(first), Memo { rest.map(transform) }) } ?? Stream<B>.Nil
return analysis(
ifCons: { first, rest in
.Cons(transform(first), rest.map { $0.map(transform) })
},
ifNil: { nil })
}