Parsing 输入上的分析错误‘;如果’;-为什么?

Parsing 输入上的分析错误‘;如果’;-为什么?,parsing,haskell,Parsing,Haskell,我不知道为什么我的程序不工作,我的ghci总是显示以下“输入时解析错误if”。 这是我的代码: import Data.List import System.IO bonuspunkte c d a b = if (a > 480) then replace a "480" else use a if (b > 375) then replace b "375" else use b if (c == True) && (d == True) t

我不知道为什么我的程序不工作,我的ghci总是显示以下“输入时解析错误
if
”。 这是我的代码:

import Data.List
import System.IO

bonuspunkte c d a b =

if (a > 480) then replace a "480" else use a
if (b > 375) then replace b "375" else use b    

if (c == True) && (d == True)   

then (11.5 *(a/480)) + (8.5 *(b/375))
else 0
我也不太确定“替换”操作,我的想法是,如果a大于480,那么你应该继续使用480。b也一样。
如果有人能帮助我,我将不胜感激。

您不能更改Haskell中变量的绑定值。但是,您可以创建一个新的变量名

bonuspunkte a b c d =
  let a' = min 480 a
      b' = min 375 b
  in if c && d then (11.5 *(a'/480)) + (8.5 *(b'/375))
               else 0
注意在if-then-else语句的公式中如何使用变量
a'
b'
-not
a
b


还要注意缩进。与Python一样,Haskell也是一种非常重要的语言。

最好知道这是什么语言……这是什么语言?蟒蛇?对不起,是哈斯克尔!什么是
replace
use
?我投票将这个问题作为离题题来结束,因为在开始学习一种新的编程语言时,堆栈溢出不能代替教程、书籍或老师。