1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 02:58:36 +03:00

Implement Free.ana without application or composition operators.

Swift can’t trace `noescape` or `rethrows` transitively through them.
This commit is contained in:
Rob Rix 2015-10-28 12:05:40 -04:00
parent 8ca7cf7599
commit f469b4f691

View File

@ -123,7 +123,7 @@ extension Free {
///
/// Unfolds a tree bottom-up by recursively applying `transform` to a series of values starting with `seed`. Since `Syntax.Leaf` does not recur, this will halt when it has produced leaves for every branch.
public static func ana(unfold: Annotation -> Syntax<Annotation, Leaf>)(_ seed: Annotation) -> Free {
return (Introduce(seed) <<< { $0.map(ana(unfold)) } <<< unfold) <| seed
return Roll(seed, unfold(seed).map(ana(unfold)))
}
}