:- module add_instance_2_r.

:- interface.

:- import_module io.

:- type foo
	--->	a
	;	b(int).

:- pred init_foo(foo::out) is det.

:- typeclass io(T) where [
	pred output(T::in, io__state::di, io__state::uo) is det
].

:- instance io(foo).

:- pred main(io__state::di, io__state::uo) is det.

:- implementation.

:- instance io(foo) where [
	pred(output/3) is io__write
].

init_foo(a).

:- import_module add_instance_2_r_2.

main -->
	{ init_foo(X) },
	output(X),
	io__nl.

