[mercury-users] "some" and existential types

Robert Ernst Johann JESCHOFNIK rejj at cat.cs.mu.OZ.AU
Sun Oct 3 17:52:52 AEST 1999


On Sun, 3 Oct 1999, Fergus Henderson wrote:

> There's an easy solution here: just declare `anything' to be an
> instance of `printable':
> 
> 	:- instance printable(anything) where [
> 		pred(print/3) is print_anything
> 	].
> 
> 	:- pred print_anything(anything::in, io__state::di, io__state::uo)
> 		is det.
> 	print_anything(thing(X)) --> print(X).
> 
> Then you can write `print_anythings(Xs) --> list__foldl(print, Xs)'
> and it should work just fine.

should this be "print_anythings(Xs) --> list__foldl(print_anything, Xs)."?
I'm still rather iffy on typeclasses and the like..


rob
--------------------------------------------------------------------------
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