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

18 lines
247 B
Swift
Raw Normal View History

2015-10-14 16:34:18 +03:00
// Copyright © 2015 GitHub. All rights reserved.
2015-10-14 16:43:51 +03:00
public enum Cofree<A, B> {
2015-10-14 16:56:46 +03:00
indirect case Unroll(B, Syntax<Cofree, A>)
2015-10-14 16:34:18 +03:00
}
2015-10-14 16:43:23 +03:00
// MARK: - Comonad
extension Cofree {
var extract: B {
switch self {
2015-10-14 16:43:51 +03:00
case let .Unroll(b, _):
2015-10-14 16:43:23 +03:00
return b
}
}
}