0.0.1 • Published 5 years ago

r-async-value v0.0.1

Weekly downloads
6
License
-
Repository
-
Last release
5 years ago

AsyncValue

An ADT for representing an async value over time

const asyncTodos: AsyncValue<Error, Todo[]> = notAsked

async function loadTodos() {
    asyncTodos = pending
    try {
        const todos = await fetchTodos()
        asyncTodos = success(todos)
    } catch (reason) {
        asyncTodos = failure(reason)
    }
}