Pages
Standard Library
Search
Entities
Result
Functions
Returns a new error result.
(Result.error("error")
|> Result.isError()) == true
Returns true if the result is an error.
(Result.error("error")
|> Result.isError()) == true
Returns true if the result is ok.
(Result.ok("ok")
|> Result.isOk()) == true
Maps over the value of the given result.
(Result.error("error")
|> Result.map(\item : String => item + "1")) == Result.error("error")
(Result.ok("ok")
|> Result.map(\item : String => item + "1")) == Result.ok("ok1")
Maps over the error of the given result.
(Result.error("error")
|> Result.mapError(\item : String => item + "1")) == Result.error("error1")
(Result.ok("ok")
|> Result.mapError(\item : String => item + "1")) == Result.ok("ok")
Returns a new ok result.
(Result.ok("ok")
|> Result.isOk()) == true
Converts the given result into a maybe.
(Result.ok("blah")
|> Result.toMaybe()) == Maybe.just("blah")
(Result.error("blah")
|> Result.toMaybe()) == Maybe.nothing()
Returns the value of the given result or the default value if it's an error.
(Result.error("error")
|> Result.withDefault("a")) == "a"
(Result.ok("ok")
|> Result.withDefault("a")) == "ok"
Returns the error of the given result or the default value if it's an ok.
(Result.error("error")
|> Result.withError("a")) == "error"
(Result.ok("ok")
|> Result.withError("a")) == "a"