r-async-value
v0.0.1
Published
An ADT for representing an async value over time
Downloads
1
Readme
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)
}
}