:- module instbug.

:- interface.

:- import_module io.

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

:- implementation.

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

:- inst a ---> a(ground).

:- typeclass foo where [pred baz(int::in, foo::out(a)) is det].
:- instance foo where [pred(baz/2) is bar].

:- pred foo(foo::in(a), int::out) is det.
foo(a(I), I).

% should be bar(int::in, foo::out(a))
:- pred bar(int::in, foo::out) is det.
bar(S, b("GOTCHA")).

main(!IO) :-
	baz(42, F),
	foo(F, I),
	print(I, !IO), nl(!IO).
