 	}
 }
 
-public func arbitraryArray<A : Arbitrary>() -> Gen<[A]> {
-	return sized({ n in
-		return choose((0, n)).bind { k in
-			return sequence(Array(1...k).map({ _ in A.arbitrary() }))
-		}
-	})
-}
-
-public func withBounds<A : LatticeType>(f : A -> A -> Gen<A>) -> Gen<A> {
-	return f(A.min)(A.max)
-}
-
 private func bits<N : IntegerType>(n : N) -> Int {
 	if n / 2 == 0 {
 		return 0


private func nub<A : Hashable>(xs : [A]) -> [A] {
	return [A](Set(xs))
}

public func shrinkNone<A>(_ : A) -> [A] {
	return []
}

private func unfoldr<A, B>(f : B -> Optional<(A, B)>, #initial : B) -> [A] {

public protocol Arbitrary {
	static func arbitrary() -> Gen<Self>
	static func shrink(Self) -> [Self]
}

/// The implementation of a shrink that returns no alternatives.
public func shrinkNone<A>(_ : A) -> [A] {
	return []
}

/// Shrinks any IntegerType.
public func shrinkIntegral<A : IntegerType>(x : A) -> [A] {
	return unfoldr({ i in
		if i <= 0 {
			return .None
		}
		let n = i / 2
		return .Some((n, n))
	}, initial: x)
}


