 ///
 /// If `signal` or any of the created producers emit an error, the returned
 /// signal will forward that error immediately.
-public func flatMap<T, U, E>(strategy: FlattenStrategy, transform: T -> SignalProducer<U, E>)(signal: Signal<T, E>) -> Signal<U, E> {
-	return signal |> map(transform) |> flatten(strategy)
+public func flatMap<T, U, E>(strategy: FlattenStrategy, transform: T -> SignalProducer<U, E>) -> Signal<T, E> -> Signal<U, E> {
+	return { signal in
+		return signal |> map(transform) |> flatten(strategy)
+	}
 }
 
 /// Returns a signal which sends all the values from each producer emitted from

	var completed = false
}

private func observeWithStates<T, U, E>(signalState: CombineLatestState<T>, otherState: CombineLatestState<U>, lock: NSRecursiveLock, onBothNext: () -> (), onError: E -> (), onBothCompleted: () -> (), onInterrupted: () -> ())(signal: Signal<T, E>) -> Disposable? {
	return signal.observe(next: { value in
		lock.lock()



/// Returns a signal that will skip the first `count` values, then forward
/// everything afterward.
public func skip<T, E>(count: Int) -> Signal<T, E> -> Signal<T, E> {
	return { signal in
		precondition(count >= 0)

		if (count == 0) {
			return signal
		}

		return Signal { observer in
			var skipped = 0

			return signal.observe(Signal.Observer { event in
				switch event {
				case let .Next(value):
					if skipped >= count {
						fallthrough
					} else {
						skipped++
					}

				default:
					observer.put(event)
				}
			})
		}
	}
}

