On 09.03.2010 20:04, boblettoj wrote:
score :: String ->  String ->  String
score [s] [] = false
score [s] [g] =
        if valid 4 g
        then (s1 ++ s2 ++ s3 ++ s4) where
                s1 = "Golds "
                s2 = show (gold s g)
                s3 = ", Silvers "
                s4 = show (silver s g)
        else "Bad Guess"

Apart from the parse error there is also a type error
in your code:
When the second argument is empty, you return false
although you declared the function to return a String,
not a boolean.

Also you require the first argument to be a string containing
exactly one character and the second argument to be a string
containing zero or one characters.
I'm not quite sure that's what you intend. If it is, you should
consider changing the function so that it takes a Char and a
Maybe Char, instead of two strings.

HTH,
Sebastian
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to