diff --git a/prototype/Doubt/Free.swift b/prototype/Doubt/Free.swift index 41d5b46ae..4c0b61ed6 100644 --- a/prototype/Doubt/Free.swift +++ b/prototype/Doubt/Free.swift @@ -21,6 +21,12 @@ public enum Free { } } + public func iter(transform: Syntax -> B) -> B { + return analysis( + ifPure: id, + ifRoll: { transform($0.map { Free.iter($0)(transform) }) }) + } + // MARK: Functor @@ -71,10 +77,3 @@ extension Free where A: Hashable, B: Hashable { return hash(ifPure: Hash.init, ifRoll: Hash.init) } } - - -public func iter(transform: Syntax -> B)(_ free: Free) -> B { - return free.analysis( - ifPure: id, - ifRoll: { transform($0.map(iter(transform))) }) -}