이 함수는 Real World Haskell에 정의되어 있습니다.하스켈 예제 함수 오류
--file ch03/Lending.hs
lend amount balance = let reserve = 100
newBalance = balance - amount
in if balance < reserve
then Nothing
else Just newBalance
나는 인터프리터에서 이것을 실행하고이 오류와 끝까지하려고 :
Lending.hs:3:54: parse error on input `='
3 호선입니다 "뉴 발란스 = 균형 - 양" 내가이 흰색 생각하지 않습니다 우주 문제 때문에 나는 진정으로 혼란 스럽다.
편집 두 로컬 변수 선언을 정렬한다 :
--file ch03/Lending.hs
lend amount balance = let reserve = 100
newBalance = balance - amount
in if balance < reserve
then Nothing
else Just newBalance
오류가 지속되면
Lending.hs:3:68: parse error on input `='
공백 문제입니다. –
'newBalance'는'reserve'와 정렬되어야합니다 – luqui
제 편집을 참조하십시오. –