 //  Copyright (c) 2014 Rob Rix. All rights reserved.
 
 /// An iterable stream.
-public enum Stream<T>: ArrayLiteralConvertible, NilLiteralConvertible, Printable {
+public enum Stream<T>: ArrayLiteralConvertible, CollectionType, NilLiteralConvertible, Printable {
 
 	// MARK: Constructors
 

	///
	/// Avoid using this directly; instead, use `nil`: `Stream` conforms to `NilLiteralConvertible`, and `nil` has better properties with respect to type inferencing.
	case Nil
}




	public init(arrayLiteral elements: T...) {
		self.init(elements)
	}


	// MARK: CollectionType

	public var startIndex: StreamIndex<T> {
		return StreamIndex(stream: self, index: isEmpty ? -1 : 0)
	}

	public var endIndex: StreamIndex<T> {
		return StreamIndex(stream: nil, index: -1)
	}

	public subscript (index: StreamIndex<T>) -> T {
		return index.stream.first!
	}


