Skip to content

Latest commit

 

History

History
92 lines (62 loc) · 1.6 KB

rx.md

File metadata and controls

92 lines (62 loc) · 1.6 KB

rx

module A very early concept of implementing functional reactive programming. Currently only used to provide mutability.

Async

enum

Cases

Future

extern Represents a value calculated in background. It will arrive some time in the future.

import results
import rx

let future = rx.Future { receive =>
    // will be performed in background
    receive results.Success 42
}

// the .await will block and wait for the result
with future.await, type results.Result {
    Success: { value => value },
    Failure: { err =>
        print err
        0 // as default
    },
}

Properties

  • await - Waits for the future to complete. This will lock the current function until the result has arrived. At the end, returns the results.Result.

Variable

extern Holds a value and enables replacing it. Planned to propagate value changes to observers, but not implemented, yet.

Properties

  • accept value - Changes the currently hold value of the variable.
  • current - Returns the currently hold value.

await

func await async

catch

func catch transform

flatMap

func flatMap transform

flatten

func flatten async

map

func map transform

onSuccess

func onSuccess sideEffect