1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 11:04:00 +03:00

Cofree is a Functor.

This commit is contained in:
Rob Rix 2015-10-14 10:09:38 -04:00
parent a606d9d798
commit 6774213fcd

View File

@ -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 {