mirror of
https://github.com/github/semantic.git
synced 2024-12-28 09:21:35 +03:00
Implement duplicate
on Cofree.
This commit is contained in:
parent
1a44f29778
commit
a606d9d798
@ -25,4 +25,8 @@ extension Cofree {
|
|||||||
public func extend<Other>(transform: Cofree -> Other) -> Cofree<A, Other> {
|
public func extend<Other>(transform: Cofree -> Other) -> Cofree<A, Other> {
|
||||||
return .Unroll(transform(self), unwrap.map { $0.extend(transform) })
|
return .Unroll(transform(self), unwrap.map { $0.extend(transform) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var duplicate: Cofree<A, Cofree<A, B>> {
|
||||||
|
return .Unroll(self, unwrap.map { $0.duplicate })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user