[clean-list] Internal overloading and unboxed arrays
David C. Norris
David_Norris at brown.edu
Tue Sep 25 19:25:31 MEST 2007
Why does the commented instance declaration below fail on {#} with an
internal overloading error, when a similar declaration for {} succeeds?
Regards,
David
----------------------------------------------
module overload
import StdEnv
class first t e :: e (t e) -> e
instance first [] e
where
first null [] = null
first _ [x:xs] = x
instance first {} e
where
first null a
| size a == 0 = null
| otherwise = select a 0
instance first {#} Char
where
first null a
| size a == 0 = null
| otherwise = select a 0
/* This causes error: 'internal overloading of "size" could not be solved'
instance first {#} e
where
first null a
| size a == 0 = null
| otherwise = select a 0
*/
Start :: (Char, Int, Real)
Start = (first (' ') "Hello",
first 0 [1, 2],
first 0.0 [1.11, 2.22])
More information about the clean-list
mailing list