Reputation: 11
I created the following code in Haskell:
eqs a b c
| ((b^2) - (4*a*c)) < 0 = "MESSAGE"
| otherwise = "x1= " ++ show (sqrt((-b + ((b^2) - (4*a*c))))2*a) ++ "x2= " show (sqrt((-b - ((b^2) - (4*a*c))))2*a)
Why do I get the following error message?
ERROR file:.\file.hs:2 - Syntax error in declaration (unexpected `;', possibly due to bad layout)
Upvotes: 0
Views: 233
Reputation: 3218
The unique problem I see in your code is a type error, not the parser error you've posted. The type error is on the following expression:
(-b + ((b^2) - (4*a*c))))2*a
I believe that you probably want to use division, so the correct expression should be
(-b + ((b^2) - (4*a*c)))) / (2*a)
Hope that this can help you. In order to better help you, please consider to post the whole content of your Haskell program file.
Upvotes: 1