 	static var linebreak: Self { get }
 	static func union(x: Self, _ y: Self) -> Self
 	
+	func flatten() -> Self
 	func beside(other: Self) -> Self
 }
 

	public static var dot: Self			{ return .char(".") }
	public static var backslash: Self	{ return .char("\\") }
	public static var equals: Self		{ return .char("=") }
}

// MARK: - extension CollectionType where Index: RandomAccessIndexType

		return .Union(x, y)
	}
	
	public func flatten() -> Document {
		switch self {
		case let .Cat(x, y):
			return .Cat(x.flatten(), y.flatten())
		case let .FlatAlt(_, x):
			return x
		case .Line:
			return .Fail
		case let .Union(x, _):
			return x.flatten()
		default:
			return self
		}
	}
	
	public func beside(doc: Document) -> Document {
		return .Cat(self, doc)
	}
