mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
Free.ana
rethrows errors.
This commit is contained in:
parent
33bd0c5644
commit
17987eff80
@ -122,8 +122,8 @@ extension Free {
|
||||
/// Anamorphism over `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(@noescape unfold: Annotation -> Syntax<Annotation, Leaf>)(_ seed: Annotation) -> Free {
|
||||
return Roll(seed, unfold(seed).map(ana(unfold)))
|
||||
public static func ana(@noescape unfold: Annotation throws -> Syntax<Annotation, Leaf>)(_ seed: Annotation) rethrows -> Free {
|
||||
return try Roll(seed, unfold(seed).map { try ana(unfold)($0) })
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user