[clean-list] Problem overloading <<< for lists

G.W.M. Vissers vissers@theochem.kun.nl
Fri, 22 Aug 2003 16:33:27 +0200 (CEST)


Hello all,

I'm trying to implement writing a list to file, and I want the behaviour 
to depend on the type of the elements in the list, like:

module tst

import StdFile

instance <<< [Int]
where
  (<<<) :: !*File ![Int] -> !*File
  (<<<) f _ = f

instance <<< [Real]
where
  (<<<) :: !*File ![Real] -> !*File
  (<<<) f _ = f

Start :: !*World -> *World
Start world
# (cons, world) = stdio world
# cons = cons <<< [1,2,3] <<< "\n"
# (ok, world) = fclose cons world
= world

 
Trying to compile this gives (Clean 2.0.2, Linux x86)

Error [tst.icl,5,<<<]:multiply defined

So it looks like the compiler ignores the type of the list elements.
Does anyone have a clue as to how to resolve this? (apart from introducing 
a new, abstract type, I mean)

Thanks,

Gé