Success type

Successful computation

Direct parent types

Result
Result of a computation
Direct subtypes: 2

Methods

Bool(s:Success) Source: stdlib.ngs:2960
Convert Success to Bool (true)

Returns

true
each(s:Success, fun:Fun) Source: stdlib.ngs:2921
Run fun with wrapped value.
filter(s:Success, predicate:Any) Source: stdlib.ngs:2948
Run predicate on wrapped value.

Returns

s or Failure

Example

Success(10).filter(X>5)   # <Success val=10>
Success(10).filter(X>15)  # <Failure val=<ResultFail ...>>
get(s:Success) Source: stdlib.ngs:2902
Gets wrapped value

Returns

Any

Example

{ 1 / 10 }.Result().get()  # 0
get(s:Success, dflt:Any) Source: stdlib.ngs:2913
Gets wrapped value

Returns

Any

Example

{ 1 / 10 }.Result().get(100)  # 0
init(s:Success, v:Any) Source: stdlib.ngs:2894
Initialize Success with the given value.
map(s:Success, fun:Fun) Source: stdlib.ngs:2928
Run fun with wrapped value. If exception is thrown, Failure is returned; otherwise Success with new vaule is returned.

Returns

Result