Other Functions

The following functions are available globally.

  • Union two possibly-nil relations together. The result is nil if both inputs are nil. We use + instead of ∪ because it’s easier to type and can still be understood.

    Declaration

    Swift

    public func + (lhs: Relation?, rhs: Relation?) -> Relation?
  • Subtract two possibly-nil relations. The result is nil if the lhs is nil, the lhs is returned if the rhs is nil, and the difference is returned if both exist.

    Declaration

    Swift

    public func - (lhs: Relation?, rhs: Relation?) -> Relation?
  • Intersect two possibly-nil relations. The result is nil if either operand is nil. I couldn’t come up with a nice ASCII version of this operator, so we get the real untypeable thing. Use copy/paste or the character viewer.

    Declaration

    Swift

    public func  (lhs: Relation?, rhs: Relation?) -> Relation?
  • For a Result that contains a sequence of Results, if it’s Ok, iterate over the sequence, accumulating new Ok values. If the Result contains Err, or any of the sequence elements are Err, then produce the first Err. This is a free-standing function because I couldn’t quite get it to work as an extension due to the extra generic types. Referencing the inner types didn’t make the compiler happy.

    Declaration

    Swift

    public func mapOk<Seq, InnerT, NewT, E>(_ result: Result<Seq, E>, _ f: (InnerT) -> NewT) -> Result<[NewT], E> where Seq : Sequence, Seq.Element == Result<InnerT, E>
  • Iterate over a sequence of Results, invoking the given function for each Ok value and returning a Result for the array it produces. If any sequence elements are Err, then return the first Err encountered.

    Declaration

    Swift

    public func mapOk<Seq, InnerT, NewT, E>(_ seq: Seq, _ f: (InnerT) -> NewT) -> Result<[NewT], E> where Seq : Sequence, Seq.Element == Result<InnerT, E>
  • Iterate over a sequence of Results, invoking the given function for each Ok value and returning a Result for the array it produces. If any sequence elements are Err, then return the first Err encountered. If the function returns nil, then that entry is omitted from the result

    Declaration

    Swift

    public func flatmapOk<Seq, InnerT, NewT, E>(_ seq: Seq, _ f: (InnerT) -> NewT?) -> Result<[NewT], E> where Seq : Sequence, Seq.Element == Result<InnerT, E>
  • Iterate over a sequence of Results, checking each value against the predicate. If a value is found where the predicate is true, return true. If an error is found first, return that error. If no matching value and no error is found, return false.

    Declaration

    Swift

    public func containsOk<Seq, T, E>(_ seq: Seq, _ predicate: (T) -> Bool) -> Result<Bool, E> where Seq : Sequence, Seq.Element == Result<T, E>
  • Iterate over a sequence of values, invoking the given Result-producing function and returning a Result for the array it produces. If an Err result is produced for any element, then return the first Err encountered.

    Declaration

    Swift

    public func traverse<Seq, InnerT, NewT, E>(_ seq: Seq, _ f: (InnerT) -> Result<NewT, E>) -> Result<[NewT], E> where Seq : Sequence, InnerT == Seq.Element
  • Take an Optional and turn it into a Result.

    Declaration

    Swift

    public func hoistOptional<T, E>(_ optionalResult: Result<T, E>?) -> Result<T?, E>
  • Undocumented

    Declaration

    Swift

    public func >>- <T, E, NT>(result: Result<T, E>, next: (T) -> Result<NT, E>) -> Result<NT, E>
  • Undocumented

    Declaration

    Swift

    public func >>>- <E>(result: Result<Void, E>, next: @autoclosure () -> Result<Void, E>) -> Result<Void, E>
  • Undocumented

    Declaration

    Swift

    public func == (a: Row, b: Row) -> Bool
  • Undocumented

    Declaration

    Swift

    public func + (a: Row, b: Row) -> Row
  • Returns an AsyncReadableProperty whose value is a tuple (pair) containing the value from each of the given properties. The returned property’s value will contain a fresh tuple any time the value of either input changes.

    Declaration

    Swift

    public func zip<LHS: AsyncReadablePropertyType, RHS: AsyncReadablePropertyType>(_ lhs: LHS, _ rhs: RHS) -> AsyncReadableProperty<(LHS.Value, RHS.Value)>
        where LHS.Value == LHS.SignalChange, RHS.Value == RHS.SignalChange
  • Returns an AsyncReadableProperty whose value is the negation of the boolean value of the given property.

    Declaration

    Swift

    public func not<P: AsyncReadablePropertyType>(_ property: P) -> AsyncReadableProperty<Bool>
        where P.Value == Bool, P.SignalChange == Bool
  • Returns an AsyncReadableProperty whose value is the negation of the given boolean property.

    Declaration

    Swift

    public prefix func !<P: AsyncReadablePropertyType>(property: P) -> AsyncReadableProperty<Bool>
        where P.Value == Bool, P.SignalChange == Bool
  • Returns a Signal that creates a fresh tuple (pair) any time there is a new value in either input.

    Declaration

    Swift

    public func zip<LHS, RHS>(_ lhs: LHS, _ rhs: RHS) -> Signal<(LHS.Value, RHS.Value)> where LHS : SignalType, RHS : SignalType
  • Returns a Signal whose value is the negation of the given boolean signal.

    Declaration

    Swift

    public func not(_ signal: Signal<Bool>) -> Signal<Bool>
  • Returns a Signal whose value resolves to the logical OR of the values delivered on the given signals.

    Declaration

    Swift

    public func *|| <LHS, RHS>(lhs: LHS, rhs: RHS) -> Signal<Bool> where LHS : SignalType, RHS : SignalType, LHS.Value == Bool, RHS.Value == Bool
  • Returns a Signal whose value resolves to the logical AND of the values delivered on the given signals.

    Declaration

    Swift

    public func *&& <LHS, RHS>(lhs: LHS, rhs: RHS) -> Signal<Bool> where LHS : SignalType, RHS : SignalType, LHS.Value == Bool, RHS.Value == Bool
  • Returns a Signal whose value resolves to true when the values delivered on the given signals are equal.

    Declaration

    Swift

    public func *== <LHS, RHS>(lhs: LHS, rhs: RHS) -> Signal<Bool> where LHS : SignalType, RHS : SignalType, LHS.Value : Equatable, LHS.Value == RHS.Value