summaryrefslogtreecommitdiff
path: root/libstd/try.myr
blob: 1539a9836fefd07182bbba043e1016fe7dea4c86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
use "option.use"
use "fmt.use"

pkg std =
	generic try : (v : option(@a) -> @a)
;;

generic try = {v
	match v
	| `Some x:	-> x
	| `None:	fatal(1, "expected `Some @a, got `None\n")
	;;
}