 	}
 	return pick(n - k, tl)
 }
+
+#if os(Linux)
+	import Glibc
+#else
+	import Darwin
+#endif
+

	if bound == 0 {
		return Gen.pure(.None)
	}
	return gen.resize(2 * k + bound).flatMap { (let x : A) -> Gen<Optional<A>> in
		if pred(x) {
			return Gen.pure(.Some(x))
		}


/// Promotes a rose of generators to a generator of rose values.
public func promote<A>(x : Rose<Gen<A>>) -> Gen<Rose<A>> {
	return delay().flatMap { eval in
		return Gen<Rose<A>>.pure(liftM(eval, x))
	}
}

/// Promotes a function returning generators to a generator of functions.
public func promote<A, B>(m : A -> Gen<B>) -> Gen<A -> B> {
	return delay().flatMap { eval in
		return Gen<A -> B>.pure(eval • m)
	}
}

// MARK: - Implementation Details

private func delay<A>() -> Gen<Gen<A> -> A> {
	return Gen(unGen: { r, n in
