0.0.1 • Published 5 years ago
r-async-value v0.0.1
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)
}
}
0.0.1
5 years ago