[m-rev.] for review: typeclasses bugfix

Ralph Becket rafe at cs.mu.OZ.AU
Fri Mar 4 13:31:39 AEDT 2005


Mark Brown, Friday,  4 March 2005:
> Estimated hours taken: 1.5
> Branches: main, release
> 
> Fix a bug with the handling of ground constraints on function calls.
> 
> Index: tests/hard_coded/typeclasses/ground_constraint_2.m
> ===================================================================
> RCS file: tests/hard_coded/typeclasses/ground_constraint_2.m
> diff -N tests/hard_coded/typeclasses/ground_constraint_2.m
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ tests/hard_coded/typeclasses/ground_constraint_2.m	3 Mar 2005 14:32:20 -0000
> @@ -0,0 +1,22 @@
> +:- module ground_constraint_2.
> +:- interface.
> +:- import_module io.
> +:- pred main(io__state::di, io__state::uo) is det.
> +:- implementation.
> +
> +main -->
> +	{ S1 = f(0) },
> +	io__write_string(S1),
> +	io__nl.

I'm pretty certain we're using state variables for IO, according to the
coding standard (if that isn't in there, it should be - I'll check.)

main(!IO) :-
	io.write_string(f(0), !IO),
	io.nl(!IO).

> +
> +:- typeclass foo(T) where [
> +	func s(T) = string
> +].
> +
> +:- instance foo(int) where [
> +	(s(_) = "bar")
> +].
> +
> +:- func f(int) = string <= foo(int).
> +f(N) = s(N).
> +
> --------------------------------------------------------------------------
> mercury-reviews mailing list
> post:  mercury-reviews at cs.mu.oz.au
> administrative address: owner-mercury-reviews at cs.mu.oz.au
> unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
> subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
> --------------------------------------------------------------------------
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list