From 26f0ea419df4dfde06cc2ecc4aa320d935bf6702 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 14 Oct 2015 10:00:16 -0400 Subject: [PATCH] Implement `extend` on Cofree. --- prototype/Doubt/Cofree.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/prototype/Doubt/Cofree.swift b/prototype/Doubt/Cofree.swift index 8e9b89325..afe4558dc 100644 --- a/prototype/Doubt/Cofree.swift +++ b/prototype/Doubt/Cofree.swift @@ -21,4 +21,8 @@ extension Cofree { return b } } + + func extend(transform: Cofree -> Other) -> Cofree { + return .Unroll(transform(self), unwrap.map { $0.extend(transform) }) + } }