小编Khu*_*har的帖子

在 Maybe 中使用 isNothing 函数时出现 Haskell 错误

我试图在 Haskell 的代码中使用 isNothing,但它给了我错误

\n
<interactive>:97:23: error:\n\xe2\x80\xa2 Variable not in scope: isNothing :: Maybe t -> Bool\n\xe2\x80\xa2 Perhaps you meant data constructor \xe2\x80\x98Nothing\xe2\x80\x99 (imported from Prelude)\n
Run Code Online (Sandbox Code Playgroud)\n

我的代码行如下 -

\n
 maybeMap f value = if isNothing (value) then value else Just (f (check value))\n
Run Code Online (Sandbox Code Playgroud)\n

isNothing value如果我替换为,则效果很好value == Nothing,所以我很困惑为什么前一个不起作用。

\n

haskell functional-programming

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

标签 统计

functional-programming ×1

haskell ×1