Skip to content

Commit

Permalink
Complete the full update to Swift 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
pthariensflame committed May 14, 2015
1 parent ede321f commit fe69b4c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Aquifer/Basic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public func concat<S: SequenceType, FR>() -> Proxy<(), S, (), S.Generator.Elemen
}

public func drain<UI, DI, DO, FR>() -> Proxy<(), UI, DI, DO, FR> {
return for_(cat(), discard)
return for_(cat()) { discard($0) }
}

public func map<UI, DO, FR>(f: UI -> DO) -> Proxy<(), UI, (), DO, FR> {
Expand All @@ -89,7 +89,7 @@ public func filter<DT, FR>(predicate: DT -> Bool) -> Proxy<(), DT, (), DT, FR> {
}
}

public func elemIndices<UI: Equatable, FR>(@autoclosure x: () -> UI) -> Proxy<(), UI, (), Int, FR> {
public func elemIndices<UI: Equatable, FR>(@autoclosure(escaping) x: () -> UI) -> Proxy<(), UI, (), Int, FR> {
return findIndices { x() == $0 }
}

Expand Down
8 changes: 4 additions & 4 deletions Aquifer/Grouping.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ public func wrap<V, R>(@autoclosure(escaping) p: () -> Proxy<X, (), (), V, Group
return GroupedProducer(GroupedProducerRepr.More { _ in p().fmap { q in q.repr } })
}

public func wrap<V, R>(@autoclosure p: () -> Proxy<X, (), (), V, R>) -> GroupedProducer<V, R> {
public func wrap<V, R>(@autoclosure(escaping) p: () -> Proxy<X, (), (), V, R>) -> GroupedProducer<V, R> {
return wrap(p().fmap { pure($0) })
}

public func delay<V, R>(@autoclosure p: () -> GroupedProducer<V, R>) -> GroupedProducer<V, R> {
public func delay<V, R>(@autoclosure(escaping) p: () -> GroupedProducer<V, R>) -> GroupedProducer<V, R> {
return GroupedProducer(p().repr)
}

Expand All @@ -77,7 +77,7 @@ extension GroupedProducer: Functor {
public typealias B = Any

public func fmap<N>(f: R -> N) -> GroupedProducer<V, N> {
return GroupedProducer<V, N>(repr.fmap(f))
return GroupedProducer<V, N>(self.repr.fmap(f))
}
}

Expand Down Expand Up @@ -123,7 +123,7 @@ public postfix func <*><V, R, N>(f: GroupedProducer<V, R -> N>) -> GroupedProduc

extension GroupedProducer: Monad {
public func bind<N>(f: R -> GroupedProducer<V, N>) -> GroupedProducer<V, N> {
return GroupedProducer<V, N>(repr.bind { f($0).repr })
return GroupedProducer<V, N>(self.repr.bind { f($0).repr })
}
}

Expand Down
8 changes: 4 additions & 4 deletions Aquifer/Operators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@
import Foundation
import Swiftz

public func respond<UO, UI, DI, DO>(@autoclosure dO: () -> DO) -> Proxy<UO, UI, DI, DO, DI> {
public func respond<UO, UI, DI, DO>(@autoclosure(escaping) dO: () -> DO) -> Proxy<UO, UI, DI, DO, DI> {
return Proxy(ProxyRepr.Respond(dO) { x in ProxyRepr.Pure { _ in x} })
}

public func request<UO, UI, DI, DO>(@autoclosure uO: () -> UO) -> Proxy<UO, UI, DI, DO, UI> {
public func request<UO, UI, DI, DO>(@autoclosure(escaping) uO: () -> UO) -> Proxy<UO, UI, DI, DO, UI> {
return Proxy(ProxyRepr.Request(uO) { x in ProxyRepr.Pure { _ in x } })
}

internal func pushRepr<UT, DT, FR>(dT: () -> DT) -> ProxyRepr<UT, DT, UT, DT, FR> {
return ProxyRepr.Respond(dT) { uT in ProxyRepr.Request({ _ in uT }) { x in pushRepr { _ in x } } }
}

public func push<UT, DT, FR>(@autoclosure dT: () -> DT) -> Proxy<UT, DT, UT, DT, FR> {
public func push<UT, DT, FR>(@autoclosure(escaping) dT: () -> DT) -> Proxy<UT, DT, UT, DT, FR> {
return Proxy(pushRepr(dT))
}

internal func pullRepr<UT, DT, FR>(uT: () -> UT) -> ProxyRepr<UT, DT, UT, DT, FR> {
return ProxyRepr.Request(uT) { dT in ProxyRepr.Respond({ _ in dT }) { x in pullRepr { _ in x } } }
}

public func pull<UT, DT, FR>(@autoclosure uT: () -> UT) -> Proxy<UT, DT, UT, DT, FR> {
public func pull<UT, DT, FR>(@autoclosure(escaping) uT: () -> UT) -> Proxy<UT, DT, UT, DT, FR> {
return Proxy(pullRepr(uT))
}

Expand Down
14 changes: 7 additions & 7 deletions Aquifer/Proxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private func pullBindExt<UO, UI, DI, DO, NI, NO, FR>(p: ProxyRepr<UO, UI, DI, DO
public struct Proxy<UO, UI, DI, DO, FR> {
private let _repr: () -> ProxyRepr<UO, UI, DI, DO, FR>

internal init(@autoclosure _ r: () -> ProxyRepr<UO, UI, DI, DO, FR>) {
internal init(@autoclosure(escaping) _ r: () -> ProxyRepr<UO, UI, DI, DO, FR>) {
_repr = r
}

Expand All @@ -109,15 +109,15 @@ public struct Proxy<UO, UI, DI, DO, FR> {
}
}

public func delay<UO, UI, DI, DO, FR>(@autoclosure p: () -> Proxy<UO, UI, DI, DO, FR>) -> Proxy<UO, UI, DI, DO, FR> {
public func delay<UO, UI, DI, DO, FR>(@autoclosure(escaping) p: () -> Proxy<UO, UI, DI, DO, FR>) -> Proxy<UO, UI, DI, DO, FR> {
return Proxy(p().repr)
}

extension Proxy: Functor {
typealias B = Any

public func fmap<NR>(f: FR -> NR) -> Proxy<UO, UI, DI, DO, NR> {
return Proxy<UO, UI, DI, DO, NR>(repr.fmap(f))
return Proxy<UO, UI, DI, DO, NR>(self.repr.fmap(f))
}
}

Expand All @@ -139,13 +139,13 @@ extension Proxy: Pointed {
}
}

public func pure<UO, UI, DI, DO, FR>(@autoclosure x: () -> FR) -> Proxy<UO, UI, DI, DO, FR> {
public func pure<UO, UI, DI, DO, FR>(@autoclosure(escaping) x: () -> FR) -> Proxy<UO, UI, DI, DO, FR> {
return Proxy(ProxyRepr.Pure(x))
}

extension Proxy: Applicative {
public func ap<NR>(f: Proxy<UO, UI, DI, DO, FR -> NR>) -> Proxy<UO, UI, DI, DO, NR> {
return Proxy<UO, UI, DI, DO, NR>(repr.ap(f.repr))
return Proxy<UO, UI, DI, DO, NR>(self.repr.ap(f.repr))
}
}

Expand All @@ -163,7 +163,7 @@ public postfix func <*><UO, UI, DI, DO, FR, NR>(f: Proxy<UO, UI, DI, DO, FR -> N

extension Proxy: Monad {
public func bind<NR>(f: FR -> Proxy<UO, UI, DI, DO, NR>) -> Proxy<UO, UI, DI, DO, NR> {
return Proxy<UO, UI, DI, DO, NR>(repr.bind { f($0).repr })
return Proxy<UO, UI, DI, DO, NR>(self.repr.bind { f($0).repr })
}
}

Expand All @@ -185,7 +185,7 @@ public func flatten<UO, UI, DI, DO, FR>(p: Proxy<UO, UI, DI, DO, Proxy<UO, UI, D

extension Proxy {
public func reflect() -> Proxy<DO, DI, UI, UO, FR> {
return Proxy<DO, DI, UI, UO, FR>(repr.reflect())
return Proxy<DO, DI, UI, UO, FR>(self.repr.reflect())
}
}

Expand Down
2 changes: 1 addition & 1 deletion Aquifer/Simple.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public func each<UO, UI, V>(seq: V...) -> Proxy<UO, UI, (), V, ()> {
return each(seq)
}

public func yield<UO, UI, DO>(@autoclosure dO: () -> DO) -> Proxy<UO, UI, (), DO, ()> {
public func yield<UO, UI, DO>(@autoclosure(escaping) dO: () -> DO) -> Proxy<UO, UI, (), DO, ()> {
return respond(dO)
}

Expand Down

0 comments on commit fe69b4c

Please sign in to comment.