| 1 |
Require Import Ltac2.Ltac2. |
| 2 |
|
| 3 |
Ltac2 Type exn ::= [ Failure ]. |
| 4 |
|
| 5 |
Ltac2 check (b : bool) := |
| 6 |
if b then () else Control.throw Failure. |
| 7 |
|
| 8 |
Ltac2 Eval |
| 9 |
let s := "Hello, world!" in |
| 10 |
let hello := String.sub s 0 5 in |
| 11 |
check (String.equal hello "Hello"). |
| 12 |
|
| 13 |
Fail Ltac2 Eval String.sub "" 2 2. |