1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 00:12:29 +03:00

Free.para’s transformation function receives the annotation.

This commit is contained in:
Rob Rix 2015-11-02 15:12:27 -05:00
parent aa815e8010
commit 3fbfeccce9

View File

@ -63,10 +63,10 @@ public enum Free<Leaf, Annotation, Value>: CustomDebugStringConvertible {
} }
/// Like `cata`, except the `Syntax` values are parameterized by the `Free` values as well as the reduced form. /// Like `cata`, except the `Syntax` values are parameterized by the `Free` values as well as the reduced form.
public func para(@noescape transform: Syntax<(Free, Value), Leaf> throws -> Value) rethrows -> Value { public func para(@noescape transform: (Annotation, Syntax<(Free, Value), Leaf>) throws -> Value) rethrows -> Value {
return try analysis( return try analysis(
ifPure: id, ifPure: id,
ifRoll: { try transform($1.map { try ($0, $0.para(transform)) }) }) ifRoll: { try transform($0, $1.map { try ($0, $0.para(transform)) }) })
} }