From b6436e91f6e1ac1832c919d92c4e951d7a27874a Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 11:03:57 -0500 Subject: [PATCH] Rewrite `hylo` without composition. --- prototype/Doubt/Syntax.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prototype/Doubt/Syntax.swift b/prototype/Doubt/Syntax.swift index f55b2da73..a66fd6b70 100644 --- a/prototype/Doubt/Syntax.swift +++ b/prototype/Doubt/Syntax.swift @@ -48,8 +48,8 @@ public enum Syntax: CustomDebugStringConvertible { /// Hylomorphisms are used to construct diffs corresponding to equal terms; see also `CofreeType.zip`. /// /// `hylo` can be used with arbitrary functors which can eliminate to and introduce with `Syntax` values. -public func hylo(down: Syntax -> B, _ up: A -> Syntax) -> A -> B { - return up >>> { $0.map(hylo(down, up)) } >>> down +public func hylo(down: Syntax -> B, _ up: A -> Syntax)(_ a: A) -> B { + return down(up(a).map(hylo(down, up))) } /// Reiteration through `Syntax`.