Haskell整数数字
示例
文字的类型
Prelude> :t 1 1 :: Num a => a
选择带有注释的具体类型
您可以指定类型,只要目标类型Num带有注释即可:
Prelude> 1 :: Int 1 it :: Int Prelude> 1 :: Double 1.0 it :: Double Prelude> 1 :: Word 1 it :: Word
如果不是,编译器会抱怨
前奏>1::字符串
<interactive>:
No instance for (Num String) arising from the literal `1'
In the expression: 1 :: String
In an equation for `it': it = 1 :: String
热门推荐
3 祝福语简短的微信
10 幼儿祝福语大全简短贺卡
11 感谢教官文案祝福语简短
12 鼠年同事祝福语简短创意
13 元旦祝福语 简短独特群发
14 妈咪跟我生日祝福语简短
15 给儿子新婚祝福语简短
16 伴娘祝福语长文案简短
17 恭喜高考完祝福语简短
18 生日祝福语送老公简短