:- module table_exn_test.

:- interface.

:- import_module io.

:- pred main(io::di, io::uo) is cc_multi.

:- implementation.

:- import_module exception.

:- type not_tabled ---> not_tabled.

:- func foo(int) = int.
:- pragma memo(foo/1).
foo(A) = X :-
	if A = 0 then throw(not_tabled) else X = 1.

main(!IO) :-
	(try [io(!IO)] _ = foo(0)
	then print("ok\n", !IO)
	catch not_tabled -> print("exn\n", !IO)),
	(try [io(!IO)] _ = foo(0)
	then print("ok\n", !IO)
	catch not_tabled -> print("exn\n", !IO)).
