summaryrefslogtreecommitdiff
path: root/libstd/try.myr
blob: 2997143bf77502c7d6f8f403e2217e992ca5bb9b (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("expected `Some @a, got `None\n")
	;;
}