1
1
mirror of https://github.com/github/semantic.git synced 2024-12-27 00:44:57 +03:00

Implement duplicate on Cofree.

This commit is contained in:
Rob Rix 2015-10-14 10:03:42 -04:00
parent 1a44f29778
commit a606d9d798

View File

@ -25,4 +25,8 @@ extension Cofree {
public func extend<Other>(transform: Cofree -> Other) -> Cofree<A, Other> {
return .Unroll(transform(self), unwrap.map { $0.extend(transform) })
}
public var duplicate: Cofree<A, Cofree<A, B>> {
return .Unroll(self, unwrap.map { $0.duplicate })
}
}