[mercury-users] ho_map typeclass question

Terrence Brannon princepawn at earthlink.net
Tue May 8 12:37:20 AEST 2001


=== question:
Given this snippet:

:- pred blah(int::in, int::out) is det.

blah(X, X+1).

why is X+1 a legal thing to send to an out parm? Does this result in a
decrement of X or what?


=== entire module included for reference


:- module ho_map.

:- interface.

:- import_module io.

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

:- implementation.

:- import_module list, int.

main -->  
	{ list__map(p, [1,2], X) }, 
	io__write(X),
	io__nl.

:- typeclass foo(T) where [
	pred p(T::in, T::out) is det
].

:- instance foo(int) where [
	pred(p/2) is blah
].

:- pred blah(int::in, int::out) is det.

blah(X, X+1).


--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list