Creates an SyncEffect<T, E> that represents a computation that may fail. This function does not execute the computation immediately, but defers execution.
SyncEffect<T, E>
The type of the successful value.
The type of the error.
A function that produces a value (or throws an error).
const safeDivide = SyncEffect(() => 10 / 2);console.log(safeDivide.run()); // Ok(5) Copy
const safeDivide = SyncEffect(() => 10 / 2);console.log(safeDivide.run()); // Ok(5)
Creates an
SyncEffect<T, E>
that represents a computation that may fail. This function does not execute the computation immediately, but defers execution.