2010/3/9 boblettoj <bobletto...@msn.com>: > > 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! > -- > View this message in context: > http://old.nabble.com/First-time-haskell---parse-error%21-tp27839657p27839657.html > Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe >
You can't use `where' in the middle of an `if'. This should get rid of the parse error: score :: String -> String -> String score [s] [] = false score [s] [g] = if valid 4 g then (s1 ++ s2 ++ s3 ++ s4) else "Bad Guess" where s1 = "Golds " s2 = show (gold s g) s3 = ", Silvers " s4 = show (silver s g) -- Deniz Dogan _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe