     
     /// - returns: A new `Tree` with the given `value` as payload.
     public func updating(value: T) -> Tree {
+        
         switch self {
         case .leaf:
             return .leaf(value)

    public var leaves: [T] {
        
        func flattened(accum: [T], tree: Tree) -> [T] {
            switch tree {
            case .branch(_, let trees):
                return trees.reduce(accum, flattened)


/// - returns: `true` if two `Tree` values are equivalent. Otherwise, `false`.
public func == <T: Equatable> (lhs: Tree<T>, rhs: Tree<T>) -> Bool {
    
    switch (lhs, rhs) {
    case (.leaf(let a), .leaf(let b)):
        return a == b
