[Haskell-cafe] First time haskell - parse error!
Brent Yorgey
byorgey at seas.upenn.edu
Tue Mar 9 17:42:42 EST 2010
On Tue, Mar 09, 2010 at 08:42:44PM +0100, Sebastian Hungerecker wrote:
> 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.
Not quite; data Bool = True | False, and the code uses a lowercase 'f'
'false'. Perhaps 'false' is defined as a String somewhere else? A bit
odd, perhaps, but not necessarily a type error.
-Brent
More information about the Haskell-Cafe
mailing list