[clean-list] instances of toString

eli+@gs211.sp.cs.cmu.edu eli+@gs211.sp.cs.cmu.edu
Fri, 3 Nov 2000 17:07:22 -0500 (EST)


Martin Wierich wrote:
> Well, you _have_ found where the StdEnv defines toString on lists. 

I was confused because I had the idea that StdEnv included some other
toString that did, for example, [1,2,3] -> "[1,2,3]".  Actually I was
seeing this toChar one -- I guess I compiled that test but didn't
bother to run it.

> The Clean compiler requires that for every instance in one scope the
> "top-level" instance type must be different. So you can't define
> e.g. one instance on lists of Foobar and another instance on lists of
> something else.

Okay, that's simple enough that I think I understand how things work.
What motivates this restriction?

> In Clean 2.0 the toString instance on lists will be removed from the StdEnv!

This seems like a good idea, so people can define generic toString on
lists (or it could be in the StdEnv) without twiddling around with
selective importing.

Thanks for your help.

-- 
     Eli Brandt  |  eli+@cs.cmu.edu  |  http://www.cs.cmu.edu/~eli/