From a606d9d7988009df7dfaf44f8351dcada09485a5 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 14 Oct 2015 10:03:42 -0400 Subject: [PATCH] Implement `duplicate` 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 9c70a67dd..33288bc9b 100644 --- a/prototype/Doubt/Cofree.swift +++ b/prototype/Doubt/Cofree.swift @@ -25,4 +25,8 @@ extension Cofree { public func extend(transform: Cofree -> Other) -> Cofree { return .Unroll(transform(self), unwrap.map { $0.extend(transform) }) } + + public var duplicate: Cofree> { + return .Unroll(self, unwrap.map { $0.duplicate }) + } }