相关疑难解决方法(0)

where语句的Haskell语法错误

我正在写一些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)

syntax haskell

2
推荐指数
1
解决办法
403
查看次数

标签 统计

haskell ×1

syntax ×1