   }
 
   @warn_unused_result
-  public func advance(i: Index, by n: Index.Distance) -> Index {
+  public func advance(i: Index, by n: IndexDistance) -> Index {
     if n >= 0 {
       return _advanceForward(i, by: n)
     }
     var i = i
-    for var offset: Index.Distance = n; offset != 0; offset = offset + 1 {
+    for var offset: IndexDistance = n; offset != 0; offset = offset + 1 {
       _previousInPlace(&i)
     }
     return i
   }
 
   @warn_unused_result
-  public func advance(i: Index, by n: Index.Distance, limit: Index) -> Index {
+  public func advance(i: Index, by n: IndexDistance, limit: Index) -> Index {
     if n >= 0 {
       return _advanceForward(i, by: n, limit: limit)
     }
     var i = i
-    for var offset: Index.Distance = n; offset != 0 && i != limit;
+    for var offset: IndexDistance = n; offset != 0 && i != limit;
         offset = offset + 1 {
       _previousInPlace(&i)
     }

  subscript(i: Index) -> Generator.Element { get set }
}

public protocol MyIndexType : Equatable {
  // Move to CollectionType?
  associatedtype Distance : SignedIntegerType = Int
}
public protocol MyIndexRangeType : Equatable {
  associatedtype Index : MyIndexType
  var startIndex: Index { get }

  @inline(__always)
  @warn_unused_result
  internal func _advanceForward(
    i: Index, by n: IndexDistance, limit: Index
  ) -> Index {
    _precondition(n >= 0,
      "Only BidirectionalIndexType can be advanced by a negative amount")

    var i = i
    for var offset: IndexDistance = 0; offset != n && i != limit; offset = offset + 1 {
      _nextInPlace(&i)
    }
    return i
  }

  @warn_unused_result
  public func advance(i: Index, by n: IndexDistance) -> Index {
    return self._advanceForward(i, by: n)
  }

  @warn_unused_result
  public func advance(i: Index, by n: IndexDistance, limit: Index) -> Index {
    return self._advanceForward(i, by: n, limit: limit)
  }

  @warn_unused_result
  public func distanceFrom(start: Index, to end: Index) -> IndexDistance {
    var start = start
    var count: IndexDistance = 0
    while start != end {
      count = count + 1
      _nextInPlace(&start)
