如何找出运算符"+"的类型? [英] How can I find out the type of operator "+"?
本文介绍了如何找出运算符"+"的类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在GHCi版本8.6.3中( https://repl.it/languages/haskell ),我想知道如何找出运算符"+"的类型.我想看看它的类型是num a, b,c => a -> b -> c
还是num a, b,c => (a,b) -> c
.
In GHCi, version 8.6.3 (https://repl.it/languages/haskell), I would like to know how to find out the type of operator "+". I want to see if its type is num a, b,c => a -> b -> c
or num a, b,c => (a,b) -> c
.
但是我找不到它的类型.它还以未知方式影响下一个表达式.为什么我失败了,我该怎么办?
But I can't find its type out. It also affects the next expression in an unknown way. Why do I fail and what shall I do then?
:type +
:type not
<interactive>:1:1: error: parse error on input ‘+’
:type not
not :: Bool -> Bool
=> "12"
推荐答案
这种方式:
> :type (+)
(+) :: Num a => a -> a -> a
还有
> :t (+) 4
(+) 4 :: Num a => a -> a
> :t (+) 4 3
(+) 4 3 :: Num a => a
这篇关于如何找出运算符"+"的类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文