我正在写一些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)
Run Code Online (Sandbox Code Playgroud)