[clean-list] [ standards design ] StdEnv StdList ( instance toString [x] ) -- possibly superfluous behavior

Arjen van Weelden A.vanWeelden at cs.ru.nl
Thu Aug 24 16:19:29 MEST 2006


Hi TK,

I don't know how it got there, it's probably very old. I think that most 
early functional languages use [Char] instead of arrays and having this 
makes converting between both representations easy. Clean doesn't really 
support things like `instance toString [Char]', and this definition does 
get in the way of other toString instances for lists. The StdEnv is `set 
in stone' as to provide backwards compatibility, and it's very difficult 
to get the CleanTeam to change anything. For instance, making the 
behavior of take or drop more logical is also not done for this reason.

kind regards,
	Arjen

TK wrote:
> Greetings, my friends!
> 
> 
> 
> 
> What is the rationale behind such standard design for this function? 
> Should there be none, it might be beneficial if it was removed( or at 
> least moved to StdLib ). Better standard behavior might be sought as well.
> 
> instance toString [x] | toChar x
>     where
>     toString::![x] -> {#Char} | toChar x
>     toString xs = ltosacc 0 xs (createArray l ' ')
>     where
>         l                    = length xs
>         ltosacc i [h:t] arr    = ltosacc (inc i) t {arr & [i]=toChar h}
>         ltosacc _ []    arr    = arr
> 
> 
> 
> 
> All the best!
> 
> 
> TK
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> clean-list mailing list
> clean-list at science.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/clean-list


More information about the clean-list mailing list