1\DOC can
2
3\TYPE {can : ('a -> 'b) -> 'a -> bool}
4
5\KEYWORDS
6Failure, exceptions.
7
8\SYNOPSIS
9Tests for failure.
10
11\DESCRIBE
12{can f x} evaluates to {true} if the application of {f} to {x} succeeds.
13It evaluates to {false} if the application fails.
14
15\FAILURE
16Only fails if {f x} raises the {Interrupt} exception.
17
18\EXAMPLE
19{
20- hd [];
21! Uncaught exception:
22! Empty
23
24- can hd [];
25> val it = false : bool
26
27- can (fn _ => raise Interrupt) 3;
28> Interrupted.
29}
30
31\SEEALSO
32Lib.assert, Lib.trye, Lib.partial, Lib.total, Lib.assert_exn.
33
34\ENDDOC
35