[Haskell-cafe] First time haskell - parse error!
Paul Johnson
paul at cogito.org.uk
Tue Mar 9 14:14:55 EST 2010
Thats because you can't put a "where" in a "then" clause. Move the
"where" stuff to the end of the function.
On 09/03/10 19:04, boblettoj wrote:
> Hi, i am getting an error when trying to compile this part of my program, its
> my first time using haskell and as lovely as it is it didn't give me very
> much to go on in the error message!
>
> <code>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"</code>
>
> when i try to compile it says: test.hs 63:29: parse error on input 'where'
> (its the line beginning with 'then')
> Anybody got any ideas whats going on?
> thanks!
>
More information about the Haskell-Cafe
mailing list