mirror of
https://github.com/github/semantic.git
synced 2024-11-25 21:43:07 +03:00
Cofree is a Functor.
This commit is contained in:
parent
a606d9d798
commit
6774213fcd
@ -12,6 +12,15 @@ public enum Cofree<A, B> {
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Functor
|
||||
|
||||
extension Cofree {
|
||||
public func map<Other>(transform: B -> Other) -> Cofree<A, Other> {
|
||||
return .Unroll(transform(extract), unwrap.map { $0.map(transform) })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Comonad
|
||||
|
||||
extension Cofree {
|
||||
|
Loading…
Reference in New Issue
Block a user