mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-19 08:31:17 +08:00
20 lines
456 B
TypeScript
20 lines
456 B
TypeScript
/// <reference path="../tsmonad.d.ts" />
|
|
|
|
var turns_out_to_be_100 = TsMonad.Maybe.just(10)
|
|
.caseOf({
|
|
just: n => n * n,
|
|
nothing: () => -1
|
|
});
|
|
|
|
var turns_out_to_be_nothing = TsMonad.Maybe.nothing<number>()
|
|
.caseOf({
|
|
just: n => n * n,
|
|
nothing: () => -1
|
|
});
|
|
|
|
var turns_out_to_be_true = TsMonad.Maybe.just(123)
|
|
.lift(n => n * 2)
|
|
.caseOf({
|
|
just: n => n === 246,
|
|
nothing: () => false
|
|
}); |