我正在编写一些 Haskell 代码来学习该语言,但遇到了语法错误:
Vec2.hs:33:27: parse error on input '='
我在这里写的代码如下。错误指向vec2Normalize
iLength = ...
我没有看到语法错误中的第二个术语
-- Get the inverse length of v and multiply the components by it
-- Resulting in the normalized form of v
vec2Normalize :: Vec2 -> Vec2
vec2Normalize v@(x,y) = (x * iLength, y * iLength)
where length = vec2Length v
iLength = if length == 0 then 1 else (1 / length)