diff --git a/prototype/Doubt/Free.swift b/prototype/Doubt/Free.swift index 6a5d0c4aa..e9bc00462 100644 --- a/prototype/Doubt/Free.swift +++ b/prototype/Doubt/Free.swift @@ -126,6 +126,11 @@ public func hylo(down: Syntax -> B, _ up: A -> Syntax>> { $0.map(hylo(down, up)) } >>> down } +public func reiterate(down: (Annotation, Syntax) -> B, _ up: A -> (Annotation, Syntax)) -> A -> B { + return up >>> { ($0, $1.map(reiterate(down, up))) } >>> down +} + + extension Free where Value: PatchType, Value.Element == Cofree { public typealias Term = Value.Element