Functions

The following functions are available globally.

  • Wraps value in Result

    Declaration

    Swift

    public func pure<V>(_ value: V) -> Result<V>
  • Wrap some throwing function from U -> V in U -> Result<V> function

    Declaration

    Swift

    public func wrap<V, U>(_ original: @escaping (V) throws -> U) -> ((V) -> Result<U>)
  • If there’s no error, perform function with value and return wrapped result

    See more

    Declaration

    Swift

    public func <^> <V, U>(_ transform: (V) -> U, result: Result<V>) -> Result<U>
  • Performs transformation over value of Result.

    See more

    Declaration

    Swift

    public func <^> <V>(_ transform: (V) -> Void, result: Result<V>)
  • Apply function wrapped in Result to Result-vrapped value

    See more

    Declaration

    Swift

    public func <*> <V, U>(_ transform: Result<(V) -> U>, result: Result<V>) -> Result<U>
  • If there’s no error, perform function that may yield Result with value and return wrapped result Left associative

    See more

    Declaration

    Swift

    public func >>- <V, U>(_ result: Result<V>,  transform: (V) -> Result<U>) -> Result<U>
  • If there’s no error, perform function that may yield Result with value and return wrapped result Right associative

    See more

    Declaration

    Swift

    public func -<< <V, U>(_ transform: (V) -> Result<U>, result: Result<V>) -> Result<U>