:- module test1.

:- interface.

:- import_module io.


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


:- implementation.

:- import_module string.


main(!IO) :-
    io.write_string("Hello world", !IO).



:- type e(E) ---> e(E).

:- type y(A) ---> y(A).

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

:- instance xxx(e(E), y(A)) <= xxx(E, A)
where
[
	% this throws an error, mixing up types?
	(xxx(e(E), y(A:_), !IO) :-
		
		xxx(E, A, !IO)
	)
	
	% this one works
	% pred(xxx/4) is test1.zzz
].

:- pred zzz(e(E)::in, y(A)::in, io::di, io::uo) is det
	<= xxx(E, A).

zzz(e(E), y(A:_), !IO) :-
	xxx(E, A, !IO).

