diff --git a/prototype/Doubt/Cofree.swift b/prototype/Doubt/Cofree.swift index 33288bc9b..ff6d9aaab 100644 --- a/prototype/Doubt/Cofree.swift +++ b/prototype/Doubt/Cofree.swift @@ -12,6 +12,15 @@ public enum Cofree { } +// MARK: - Functor + +extension Cofree { + public func map(transform: B -> Other) -> Cofree { + return .Unroll(transform(extract), unwrap.map { $0.map(transform) }) + } +} + + // MARK: - Comonad extension Cofree {