“No instance for” error

[亡魂溺海] 提交于 2019-12-05 08:05:41

Haskell thinks you're trying to subtract 3 from abs, and is complaining that abs is not a number. You need to add parenthesis when using the unary negation operator:

abs (-3)

The interpreter thinks you mean abs - 3 not abs (-3). You need brackets to disambiguate the code and make sure it's clear that you intend to use the unary "-" function, not the subtraction operator.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!