
I just got back from a high-school programming competition where the only allowed languages were C[++] and Java (*grmbl*). To see just how cool Haskell is, I'm redoing some of the problems in this more enlightened language :-) Anyway, that explains the rather strict requirements for my program's interface. At one point, the user must enter pairs of numbers like so: 1 4 2 4 3 2 4 1 4 3 0 0 (where two zeros terminate the input). Here is my latest attempt at a function to do this part of the problem (and it's the easy part ...) --- snip --- -- type Player = Int readIncompatList :: IO [(Player, Player)] readIncompatList = readIL' [] where readIL' ans = do a <- readDec b <- readDec if a == 0 && b == 0 then ans else readIL' ((a, b):ans) --- snip --- GHC complains with the following: --- snip --- prob13.hs:37: Couldn't match `String -> t' against `[t1]' Expected type: String -> t Inferred type: [t1] Probable cause: `(:)' is applied to too many arguments in the call ((:) (a, b) ans) In the first argument of `readIL'', namely `((a, b) : ans)' --- snip --- Of course, this "probable cause" is ridiculous at face value ... anyway, my code makes as much sense to me as it can at the moment ... how should I get it to make sense to GHC? (I couldn't find any examples on something as mundane as console I/O; funny how people are so fixated on the real stuff :-) ) Thanks! Jyrinx jyrinx_list@mindspring.com