 		return [Element](Set(self))
 	}
 }
-
-private func unfoldr<A, B>(_ f : (B) -> Optional<(A, B)>, initial : B) -> [A] {
-	var acc = [A]()
-	var ini = initial
-	while let next = f(ini) {
-		acc.append(next.0)
-		ini = next.1
-	}
-	return acc.reversed()
-}
-
 #if os(Linux)
 	import Glibc
 #else

extension FixedWidthInteger {
	/// Shrinks any `IntegerType`.
	public var shrinkIntegral : [Self] {
		return unfoldr({ i in
			if i <= 0 {
				return .none
			}
			let n = i / 2
			return .some((n, n))
		}, initial: self < 0 ? self.multipliedReportingOverflow(by: -1).partialValue : self)
	}
}


extension BinaryInteger {
	/// Shrinks any `Numeric` type.
	public var shrinkIntegral : [Self] {
		let start = self < 0 ? (self * -1) : self
		return [Self](sequence(state: start) { i in
			if i <= 0 {
				return .none
			}
			i = i / 2
			return .some(i)
		})
	}
}

