如何找出运算符“+”的类型?

2024-01-10

在 GHCi 版本 8.6.3 中(https://repl.it/languages/haskell https://repl.it/languages/haskell),我想知道如何找出运算符“+”的类型。我想看看它的类型是否是num a, b,c => a -> b -> c or num a, b,c => (a,b) -> c.

但我找不到它的类型。它还以未知的方式影响下一个表达式。为什么我会失败,然后我该怎么办?

   :type +
   :type not
<interactive>:1:1: error: parse error on input ‘+’
   :type not
not :: Bool -> Bool
=> "12"

这边走:

> :type (+)
(+) :: Num a => a -> a -> a

And also

> :t (+) 4
(+) 4 :: Num a => a -> a

> :t (+) 4 3
(+) 4 3 :: Num a => a
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何找出运算符“+”的类型? 的相关文章

随机推荐