
6 Dec
2002
6 Dec
'02
7:26 a.m.
Hi there, I wonder if the compiler could check, if all possible combinations have been checked in a pattern match. For example: data Colour = Red | Yellow | Green | Blue; trafficlight Red = True; trafficlight Yellow = True; trafficlight Green = True; trafficlight Blue = False; This is complete and okay. But, if somebody adds Magenta to Colour, then the function trafficlight becomes incomplete and the program might terminate at runtime whereas before it could not. (Of course, there could be dozens of more complicated case scattered over multiple files ...) If this could be checked, shouldn't it be an compile time error to have incomplete functions? Cheers, Ingo