This repository has been archived on 2024-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
huia/packages/core/result.huia

14 lines
269 B
Text
Raw Normal View History

deftrait Result, as: ->
defstatic ok value: Any, as: -> Result.Ok.new(value)
defstatic error error: Error, as: -> Result.Error.new(error)
defstatic none as: -> Result.None.new()
def ok?
def error?
def <Any> unwrap
def <Any> expect message: String
end