mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
Memo can print itself.
This commit is contained in:
parent
b25095372a
commit
ece5c942d5
@ -1,4 +1,4 @@
|
||||
public struct Memo<A> {
|
||||
public struct Memo<A>: CustomDebugStringConvertible, CustomStringConvertible {
|
||||
public init(unevaluted: () -> A) {
|
||||
self.init(.Unevaluated(unevaluted))
|
||||
}
|
||||
@ -25,6 +25,15 @@ public struct Memo<A> {
|
||||
public func flatMap<B>(transform: A -> Memo<B>) -> Memo<B> {
|
||||
return Memo<B> { transform(self.value).value }
|
||||
}
|
||||
|
||||
|
||||
public var description: String {
|
||||
return String(value)
|
||||
}
|
||||
|
||||
public var debugDescription: String {
|
||||
return String(reflecting: value)
|
||||
}
|
||||
}
|
||||
|
||||
private final class MutableBox<A> {
|
||||
|
Loading…
Reference in New Issue
Block a user